Skip to content

Commit 0648d8d

Browse files
authored
feat(core/menu): implement w3c menu pattern for ix-menu (#2573)
1 parent 2a6055f commit 0648d8d

16 files changed

Lines changed: 949 additions & 159 deletions

File tree

.changeset/fair-falcons-search.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@siemens/ix': minor
3+
---
4+
5+
Improved **ix-menu** accessibility by implementing the W3C menubar pattern, adding better keyboard navigation and screenreader suppport.
6+
Added properties `i18nAriaLabelMenu` and `i18nNavigationHint` for screenreader translations.

packages/angular/src/components.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,15 +1558,15 @@ export declare interface IxLinkButton extends Components.IxLinkButton {}
15581558

15591559

15601560
@ProxyCmp({
1561-
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
1561+
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nAriaLabelMenu', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nNavigationHint', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
15621562
methods: ['toggleMapExpand', 'toggleMenu', 'toggleSettings', 'toggleAbout']
15631563
})
15641564
@Component({
15651565
selector: 'ix-menu',
15661566
changeDetection: ChangeDetectionStrategy.OnPush,
15671567
template: '<ng-content></ng-content>',
15681568
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1569-
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
1569+
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nAriaLabelMenu', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nNavigationHint', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
15701570
outputs: ['expandChange', 'mapExpandChange', 'openAppSwitch', 'openSettings', 'openAbout'],
15711571
standalone: false
15721572
})

packages/angular/standalone/src/components.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,15 +1663,15 @@ export declare interface IxLinkButton extends Components.IxLinkButton {}
16631663

16641664
@ProxyCmp({
16651665
defineCustomElementFn: defineIxMenu,
1666-
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
1666+
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nAriaLabelMenu', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nNavigationHint', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
16671667
methods: ['toggleMapExpand', 'toggleMenu', 'toggleSettings', 'toggleAbout']
16681668
})
16691669
@Component({
16701670
selector: 'ix-menu',
16711671
changeDetection: ChangeDetectionStrategy.OnPush,
16721672
template: '<ng-content></ng-content>',
16731673
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1674-
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
1674+
inputs: ['applicationDescription', 'applicationName', 'enableToggleTheme', 'expand', 'i18nAriaLabelMenu', 'i18nCollapse', 'i18nExpand', 'i18nLegal', 'i18nNavigationHint', 'i18nSettings', 'i18nToggleTheme', 'pinned', 'showAbout', 'showSettings', 'startExpanded'],
16751675
outputs: ['expandChange', 'mapExpandChange', 'openAppSwitch', 'openSettings', 'openAbout'],
16761676
})
16771677
export class IxMenu {

packages/core/src/components.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,6 +2405,12 @@ export namespace Components {
24052405
* @default false
24062406
*/
24072407
"expand": boolean;
2408+
/**
2409+
* i18n aria-label for menu. Gets read out by screen readers when first focusing the menu
2410+
* @since 5.1.0
2411+
* @default 'Application Navigation'
2412+
*/
2413+
"i18nAriaLabelMenu": string;
24082414
/**
24092415
* i18n label for 'Collapse' button
24102416
* @default 'Collapse'
@@ -2420,6 +2426,12 @@ export namespace Components {
24202426
* @default 'About & legal information'
24212427
*/
24222428
"i18nLegal": string;
2429+
/**
2430+
* i18n description for menu keyboard navigation hint, read by screen readers when focusing the menu
2431+
* @since 5.1.0
2432+
* @default 'Use Up and Down arrow keys to navigate between menu items'
2433+
*/
2434+
"i18nNavigationHint": string;
24232435
/**
24242436
* i18n label for 'Settings' button
24252437
* @default 'Settings'
@@ -2610,6 +2622,7 @@ export namespace Components {
26102622
* Show notification count on the category
26112623
*/
26122624
"notifications"?: number;
2625+
"setTabIndex": (value: number) => Promise<void>;
26132626
/**
26142627
* Will be shown as tooltip text, if not provided menu text content will be used.
26152628
* @since 4.0.0
@@ -2680,6 +2693,7 @@ export namespace Components {
26802693
* Label of the menu item. Will also be used as tooltip text
26812694
*/
26822695
"label"?: string;
2696+
"menuCategoryLabel"?: string;
26832697
/**
26842698
* Show notification count on tab
26852699
*/
@@ -2689,6 +2703,7 @@ export namespace Components {
26892703
* @since 4.0.0
26902704
*/
26912705
"rel"?: string;
2706+
"setTabIndex": (value: number) => Promise<void>;
26922707
/**
26932708
* Specifies where to open the linked document when href is provided.
26942709
* @since 4.0.0
@@ -9064,6 +9079,12 @@ declare namespace LocalJSX {
90649079
* @default false
90659080
*/
90669081
"expand"?: boolean;
9082+
/**
9083+
* i18n aria-label for menu. Gets read out by screen readers when first focusing the menu
9084+
* @since 5.1.0
9085+
* @default 'Application Navigation'
9086+
*/
9087+
"i18nAriaLabelMenu"?: string;
90679088
/**
90689089
* i18n label for 'Collapse' button
90699090
* @default 'Collapse'
@@ -9079,6 +9100,12 @@ declare namespace LocalJSX {
90799100
* @default 'About & legal information'
90809101
*/
90819102
"i18nLegal"?: string;
9103+
/**
9104+
* i18n description for menu keyboard navigation hint, read by screen readers when focusing the menu
9105+
* @since 5.1.0
9106+
* @default 'Use Up and Down arrow keys to navigate between menu items'
9107+
*/
9108+
"i18nNavigationHint"?: string;
90829109
/**
90839110
* i18n label for 'Settings' button
90849111
* @default 'Settings'
@@ -9371,6 +9398,7 @@ declare namespace LocalJSX {
93719398
* Label of the menu item. Will also be used as tooltip text
93729399
*/
93739400
"label"?: string;
9401+
"menuCategoryLabel"?: string;
93749402
/**
93759403
* Show notification count on tab
93769404
*/
@@ -12061,6 +12089,8 @@ declare namespace LocalJSX {
1206112089
"expand": boolean;
1206212090
"startExpanded": boolean;
1206312091
"pinned": boolean;
12092+
"i18nAriaLabelMenu": string;
12093+
"i18nNavigationHint": string;
1206412094
"i18nLegal": string;
1206512095
"i18nSettings": string;
1206612096
"i18nToggleTheme": string;
@@ -12127,6 +12157,7 @@ declare namespace LocalJSX {
1212712157
"target": AnchorTarget;
1212812158
"rel": string;
1212912159
"isCategory": boolean;
12160+
"menuCategoryLabel": string;
1213012161
}
1213112162
interface IxMenuSettingsAttributes {
1213212163
"suppressLegacyTabs": boolean;

0 commit comments

Comments
 (0)