-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui5-notification): implement keyboard navigation spec (#8975)
`ui5-notification-list` component is included to enhance accessibility. BREAKING CHANGE: Instead of `ui5-list`, `ui5-notification-list` should be used as a container for `ui5-li-notification-group` and `ui5-li-notification` components. Previously the application developers were defining notifications in this way: ``` <ui5-list> <ui5-li-notification-group title-text="Group Title" > <ui5-li-notification.. ``` To support accessibility, developers should now use the `ui5-notification-list` as seen below: ``` <ui5-notification-list> <ui5-li-notification-group title-text="Group Title" > <ui5-li-notification.. ```
- Loading branch information
1 parent
2a8c252
commit d68c883
Showing
22 changed files
with
395 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js"; | ||
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js"; | ||
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js"; | ||
import ListItemBase from "@ui5/webcomponents/dist/ListItemBase.js"; | ||
import List from "@ui5/webcomponents/dist/List.js"; | ||
import NotificationListGroupItem from "./NotificationListGroupItem.js"; | ||
|
||
// Texts | ||
import { | ||
NOTIFICATION_LIST_ACCESSIBLE_NAME, | ||
} from "./generated/i18n/i18n-defaults.js"; | ||
|
||
/** | ||
* @class | ||
* | ||
* The `ui5-notification-list` web component represents | ||
* a container for `ui5-li-notification-group` and `ui5-li-notification`. | ||
* | ||
* @constructor | ||
* @extends List | ||
* @since 2.0 | ||
* @public | ||
*/ | ||
@customElement("ui5-notification-list") | ||
|
||
class NotificationList extends List { | ||
constructor() { | ||
super(); | ||
this.accessibleName = NotificationList.i18nFioriBundle.getText(NOTIFICATION_LIST_ACCESSIBLE_NAME); | ||
} | ||
|
||
static i18nFioriBundle: I18nBundle; | ||
|
||
getEnabledItems(): Array<ListItemBase> { | ||
const items = new Array<ListItemBase>(); | ||
|
||
this.getItems().forEach(item => { | ||
items.push(item); | ||
|
||
if (item instanceof NotificationListGroupItem && !item.collapsed) { | ||
item.items.forEach(subItem => { | ||
items.push(subItem); | ||
}); | ||
} | ||
}); | ||
|
||
return items; | ||
} | ||
|
||
static async onDefine() { | ||
NotificationList.i18nFioriBundle = await getI18nBundle("@ui5/webcomponents-fiori"); | ||
} | ||
} | ||
|
||
NotificationList.define(); | ||
|
||
export default NotificationList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import List from "@ui5/webcomponents/dist/List.js"; | ||
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js"; | ||
|
||
/** | ||
* @class | ||
* | ||
* Internal `ui5-li-notification-group-list` component, | ||
* that is used to support keyboard navigation of the notification group internal list. | ||
* | ||
* @private | ||
*/ | ||
@customElement("ui5-notification-group-list") | ||
class NotificationListGroupList extends List { | ||
getEnabledItems() { | ||
return []; | ||
} | ||
|
||
_handleTabNext() { | ||
} | ||
|
||
onForwardBefore() { | ||
} | ||
|
||
onForwardAfter() { | ||
} | ||
} | ||
|
||
NotificationListGroupList.define(); | ||
|
||
export default NotificationListGroupList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.