Skip to content

fix(telekom-nav-list): expose main navigation links as links, not menu items - #2571

Open
khushi-git-7 wants to merge 2 commits into
telekom:mainfrom
khushi-git-7:fix/2557-main-nav-link-roles
Open

khushi-git-7 wants to merge 2 commits into
telekom:mainfrom
khushi-git-7:fix/2557-main-nav-link-roles

Conversation

@khushi-git-7

@khushi-git-7 khushi-git-7 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2557

@maomaoZH @amir-ba could one of you review this? It follows the approach I proposed on the issue.

scale-telekom-nav-list defaulted to role="menu", and scale-telekom-nav-item then gave its link role="menuitem", so the main navigation was announced as an application menu instead of a list of links.

  • scale-telekom-nav-list: with no role set, a variant="main-nav" list (also the default variant) gets role="list". The other variants keep role="menu".
  • scale-telekom-nav-item: with no role set, an item in a role="list" parent gets role="listitem", otherwise role="none" as before. Since the parent isn't a menu, the link keeps its native role.
  • A direct child of a role="list" nav list that isn't a nav item and has no role, such as the scale-menu-flyout wrapper in the dropdown composition, gets role="listitem". The nav item inside it then keeps role="none", so the list still has list items.
  • A role set by the consumer is still used for both. The role props no longer have a default value or reflect, so the computed role can be set on the host. With reflect, Stencil writes the prop value over the host's role attribute.
  • The prop descriptions and the generated readmes are updated.

Tests: new telekom-nav-list.spec.ts:

  • main-nav gives list / listitem and the link has no role
  • no variant behaves like main-nav
  • functions keeps menu / none / menuitem
  • a scale-menu-flyout wrapper becomes the listitem, the nav item inside it stays none, and its button has no role
  • role="menu" set on a main-nav list keeps the menu roles

I ran build-pr on my fork. With the change, every job passes (tslint, prettier, uncommitted changes, unit, e2e and visual tests). With only the source change reverted, the three main-nav tests fail and the rest pass. The e2e test "should skip disabled options when typing" failed once in that run, as it did on #2568; it's timing-sensitive and unrelated.

…u items

A nav list with variant="main-nav" defaulted to role="menu", so its items set role="menuitem" on their links. Default the main-nav list to role="list" and its items to role="listitem", and keep the native link role. The other variants keep their menu roles, and a role set by the consumer is still used.

Closes telekom#2557
Copilot AI balanced review requested due to automatic review settings November 19, 2026 18:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The supported flyout dropdown composition assigns role="none" to navigation items, leaving the enclosing list without listitem descendants and breaking its accessibility semantics.

1 open issue
What changed in this PR

Updates Telekom main navigation to expose a list of native links rather than an application menu, addressing #2557 while preserving menu semantics for other variants and explicit consumer roles.

Changes:

  • Computes default list and item roles from the navigation variant and parent role.
  • Adds role tests for main navigation, the default variant, function navigation, and explicit overrides.
  • Updates prop descriptions and generated documentation.
File Description
packages/​components/​src/​components/​telekom/​telekom-nav-list/​telekom-nav-list.tsx Computes and applies the list’s default role.
packages/​components/​src/​components/​telekom/​telekom-nav-list/​telekom-nav-list.spec.ts Adds navigation-role regression tests.
packages/​components/​src/​components/​telekom/​telekom-nav-list/​readme.md Documents variant-dependent role defaults.
packages/​components/​src/​components/​telekom/​telekom-nav-item/​telekom-nav-item.tsx Derives item semantics from the parent role.
packages/​components/​src/​components/​telekom/​telekom-nav-item/​readme.md Documents parent-dependent item role defaults.

Review effort: Balanced

Comment on lines +88 to +89
const parentRole = this.hostElement.parentElement?.getAttribute('role');
return parentRole === 'list' ? 'listitem' : 'none';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch. Fixed in 52c1f55: when the nav list has role="list", a direct child that isn't a nav item and has no role of its own, like the scale-menu-flyout wrapper, gets role="listitem". The nav item inside the wrapper keeps role="none" and its button keeps its native role. A new spec test covers this composition.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scale-telekom-nav-list: main navigation links are exposed as menuitems

2 participants