Skip to content

Commit 755279c

Browse files
authored
chore(ui5-side-navigation): add invisible texts for primary and footer list trees (SAP#11464)
The SideNavigation component now includes descriptive labels (aria-label) for both the primary and footer navigation sections. JIRA: BGSOFUIRODOPI-3230
1 parent 6ad3386 commit 755279c

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

packages/fiori/cypress/specs/SideNavigation.cy.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,28 @@ describe("Side Navigation Accessibility", () => {
866866
.find(".ui5-sn-item-ul")
867867
.should("have.attr", "role", "group");
868868
});
869+
870+
it("Tests Primary and Footer Navigation Lists accessibility", () => {
871+
cy.mount(
872+
<SideNavigation id="sn">
873+
<SideNavigationItem text="Home"></SideNavigationItem>
874+
<SideNavigationItem text="1" />
875+
<SideNavigationItem slot="fixedItems" text="2" />
876+
<SideNavigationItem slot="fixedItems" text="3" />
877+
</SideNavigation>
878+
);
879+
880+
// assert
881+
cy.get("#sn")
882+
.shadow()
883+
.find(".ui5-sn-flexible")
884+
.should("have.attr", "aria-label", "Primary Navigation Menu");
885+
886+
cy.get("#sn")
887+
.shadow()
888+
.find(".ui5-sn-fixed")
889+
.should("have.attr", "aria-label", "Footer Navigation Menu");
890+
});
869891
});
870892

871893
describe("Focusable items", () => {

packages/fiori/src/SideNavigation.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import {
3838
SIDE_NAVIGATION_COLLAPSED_LIST_ARIA_ROLE_DESC,
3939
SIDE_NAVIGATION_LIST_ARIA_ROLE_DESC,
4040
SIDE_NAVIGATION_OVERFLOW_ACCESSIBLE_NAME,
41+
SIDE_NAVIGATION_FLEXIBLE_LIST_LABEL,
42+
SIDE_NAVIGATION_FIXED_LIST_LABEL,
4143
} from "./generated/i18n/i18n-defaults.js";
4244

4345
// Styles
@@ -290,6 +292,14 @@ class SideNavigation extends UI5Element {
290292
return SideNavigation.i18nBundle.getText(key);
291293
}
292294

295+
get navigationMenuPrimaryHiddenText() {
296+
return SideNavigation.i18nBundle.getText(SIDE_NAVIGATION_FLEXIBLE_LIST_LABEL);
297+
}
298+
299+
get navigationMenuFooterHiddenText() {
300+
return SideNavigation.i18nBundle.getText(SIDE_NAVIGATION_FIXED_LIST_LABEL);
301+
}
302+
293303
get overflowAccessibleName() {
294304
return SideNavigation.i18nBundle.getText(SIDE_NAVIGATION_OVERFLOW_ACCESSIBLE_NAME);
295305
}

packages/fiori/src/SideNavigationTemplate.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default function SideNavigationTemplate(this: SideNavigation) {
1919
class="ui5-sn-list ui5-sn-flexible"
2020
aria-orientation="vertical"
2121
aria-roledescription={this.ariaRoleDescNavigationList}
22+
aria-label={this.navigationMenuPrimaryHiddenText}
2223
>
2324
<slot></slot>
2425
<SideNavigationItem
@@ -35,6 +36,7 @@ export default function SideNavigationTemplate(this: SideNavigation) {
3536
<ul role="tree"
3637
class="ui5-sn-list ui5-sn-flexible"
3738
aria-roledescription={this.ariaRoleDescNavigationList}
39+
aria-label={this.navigationMenuPrimaryHiddenText}
3840
>
3941
<slot></slot>
4042
</ul>
@@ -47,13 +49,15 @@ export default function SideNavigationTemplate(this: SideNavigation) {
4749
class="ui5-sn-list ui5-sn-fixed"
4850
aria-orientation="vertical"
4951
aria-roledescription={this.ariaRoleDescNavigationList}
52+
aria-label={this.navigationMenuFooterHiddenText}
5053
>
5154
<slot name="fixedItems"></slot>
5255
</div>
5356
:
5457
<ul role="tree"
5558
class="ui5-sn-list ui5-sn-fixed"
5659
aria-roledescription={this.ariaRoleDescNavigationList}
60+
aria-label={this.navigationMenuFooterHiddenText}
5761
>
5862
<slot name="fixedItems"></slot>
5963
</ul>

packages/fiori/src/i18n/messagebundle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,12 @@ SIDE_NAVIGATION_LIST_ITEMS_ARIA_ROLE_DESC=Navigation List Tree Item
498498
#XTXT: Accessible name for the Side Navigation overflow item
499499
SIDE_NAVIGATION_OVERFLOW_ACCESSIBLE_NAME=More Items
500500

501+
#XTXT: Text for the Side Navigation Primary list
502+
SIDE_NAVIGATION_FLEXIBLE_LIST_LABEL=Primary Navigation Menu
503+
504+
#XTXT: Text for the Side Navigation Footer list
505+
SIDE_NAVIGATION_FIXED_LIST_LABEL=Footer Navigation Menu
506+
501507
#XTXT
502508
SIDE_NAVIGATION_ICON_COLLAPSE=Colapse
503509

0 commit comments

Comments
 (0)