Skip to content

Commit

Permalink
fix(ui5-li-notification): fix aria-level value (#9504)
Browse files Browse the repository at this point in the history
* fix(ui5-li-notification): fix aria-level value
  • Loading branch information
TeodorTaushanov authored Jul 19, 2024
1 parent a77cd4b commit ca153d0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/fiori/src/NotificationListGroupItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import BusyIndicator from "@ui5/webcomponents/dist/BusyIndicator.js";
import Icon from "@ui5/webcomponents/dist/Icon.js";
import NotificationListGroupList from "./NotificationListGroupList.js";
import NotificationListItemBase from "./NotificationListItemBase.js";
import type NotificationListItem from "./NotificationListItem.js";

// Icons
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
Expand Down Expand Up @@ -103,10 +104,15 @@ class NotificationListGroupItem extends NotificationListItemBase {
* @public
*/
@slot({ type: HTMLElement, "default": true })
items!: Array<NotificationListItemBase>
items!: Array<NotificationListItem>

onBeforeRendering() {
super.onBeforeRendering();

this.items.forEach(item => {
item._ariaLevel = "2";
});

if (this.loading) {
this.clearChildBusyIndicator();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/src/NotificationListItem.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@click="{{_onclick}}"
tabindex="{{forcedTabIndex}}"
aria-labelledby="{{ariaLabelledBy}}"
aria-level="2"
aria-level="{{_ariaLevel}}"
>
{{#if loading}}
<span id="{{_id}}-loading" class="ui5-hidden-text">{{loadingText}}</span>
Expand Down
2 changes: 2 additions & 0 deletions packages/fiori/src/NotificationListItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ class NotificationListItem extends NotificationListItemBase {
_descOverflowHeight: number;
_onResizeBound: ResizeObserverCallback;

_ariaLevel : string | undefined;

constructor() {
super();

Expand Down
13 changes: 13 additions & 0 deletions packages/fiori/test/specs/NotificationList.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,3 +518,16 @@ describe("Keyboard navigation", () => {
});
});

describe("Notification List Item Without a Group", () => {
before(async () => {
await browser.url(`test/pages/NotificationListItem.html`);
});

it("ACC", async () => {
const item1 = await browser.$("#notificationListWithMenu [ui5-li-notification]");
const item1Root = await item1.shadow$(".ui5-nli-root");

assert.notOk(await item1Root.getAttribute("aria-level"), "aria-level is not set");
});
});

0 comments on commit ca153d0

Please sign in to comment.