-
Notifications
You must be signed in to change notification settings - Fork 138
feat(core/dropdown): support roving tabindex keyboard navigation #2659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
danielleroux
wants to merge
8
commits into
main
Choose a base branch
from
feat/dropdown-roving-tabindex
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a2a7d26
feat(core/dropdown): support roving tabindex keyboard navigation
danielleroux 220f333
Merge remote-tracking branch 'origin/main' into feat/dropdown-roving-โฆ
danielleroux 68d8f07
fix restore tabindex
danielleroux 1d5c69b
simplify controller setup
danielleroux c1ab471
add roving support to dropdown-button
danielleroux a98b7ff
Merge branch 'main' into feat/dropdown-roving-tabindex
danielleroux 76fca3f
fix(dropdown): prevent default action for child dropdown triggers
danielleroux 4bbd405
review comments
danielleroux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| '@siemens/ix': minor | ||
| --- | ||
|
|
||
| Added a `navigationMode` property to `ix-dropdown` (and passed through by `ix-dropdown-button`) that selects the keyboard navigation strategy. The new `roving-tabindex` mode moves real DOM focus between items via a roving `tabindex` (`0` for the active item, `-1` for the rest), so items are actually focused and no `aria-activedescendant` is required. Besides the built-in item components, arbitrary focusable elements (e.g. a native `<button>`) can opt into this navigation by adding the `data-ix-roving-item` attribute; such native elements keep their own activation (<kbd>Enter</kbd> / <kbd>Space</kbd> fire a real click). In this mode pressing <kbd>Tab</kbd> / <kbd>Shift</kbd>+<kbd>Tab</kbd> closes the dropdown and moves focus to the next/previous element in the active focus scope, including an owning `ix-popover`. Dropdowns and popovers now share nested-overlay ownership so item-triggered popovers remain open; <kbd>Escape</kbd> closes a complete dropdown hierarchy before its owning popover, while nested popovers close one at a time. The default `active-descendant` mode keeps the existing behavior where DOM focus stays on the trigger and a visual focus indicator moves between items. |
This file contains hidden or 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
42 changes: 42 additions & 0 deletions
42
packages/angular-standalone-test-app/src/preview-examples/dropdown-roving-tabindex.ts
This file contains hidden or 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,42 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2026 Siemens AG | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import { Component } from '@angular/core'; | ||
| import { | ||
| IxButton, | ||
| IxDropdown, | ||
| IxDropdownHeader, | ||
| IxDropdownItem, | ||
| IxDivider, | ||
| IxDropdownTriggerDirective, | ||
| } from '@siemens/ix-angular/standalone'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-example', | ||
| imports: [ | ||
| IxButton, | ||
| IxDropdown, | ||
| IxDropdownHeader, | ||
| IxDropdownItem, | ||
| IxDivider, | ||
| IxDropdownTriggerDirective, | ||
| ], | ||
| template: ` | ||
| <ix-button #trigger>Open</ix-button> | ||
| <ix-dropdown [ixDropdownTrigger]="trigger" navigationMode="roving-tabindex"> | ||
| <ix-dropdown-header label="Category"></ix-dropdown-header> | ||
| <ix-dropdown-item label="Item 2"></ix-dropdown-item> | ||
| <ix-dropdown-item label="Item 3"></ix-dropdown-item> | ||
| <ix-dropdown-item label="Item 4"></ix-dropdown-item> | ||
| <ix-divider></ix-divider> | ||
| <ix-dropdown-item label="Item 5"></ix-dropdown-item> | ||
| </ix-dropdown> | ||
| `, | ||
| }) | ||
| export default class DropdownRovingTabindex {} |
This file contains hidden or 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 hidden or 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
27 changes: 27 additions & 0 deletions
27
packages/angular-test-app/src/preview-examples/dropdown-roving-tabindex.ts
This file contains hidden or 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,27 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2026 Siemens AG | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import { Component } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| standalone: false, | ||
| selector: 'app-example', | ||
| template: ` | ||
| <ix-button #trigger>Open</ix-button> | ||
| <ix-dropdown [ixDropdownTrigger]="trigger" navigationMode="roving-tabindex"> | ||
| <ix-dropdown-header label="Category"></ix-dropdown-header> | ||
| <ix-dropdown-item label="Item 2"></ix-dropdown-item> | ||
| <ix-dropdown-item label="Item 3"></ix-dropdown-item> | ||
| <ix-dropdown-item label="Item 4"></ix-dropdown-item> | ||
| <ix-divider></ix-divider> | ||
| <ix-dropdown-item label="Item 5"></ix-dropdown-item> | ||
| </ix-dropdown> | ||
| `, | ||
| }) | ||
| export default class DropdownRovingTabindex {} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.