Skip to content

fix(aria/listbox): allow navigation to specific index#33485

Merged
crisbeto merged 1 commit into
angular:mainfrom
crisbeto:aria-listbox-goto
Jul 3, 2026
Merged

fix(aria/listbox): allow navigation to specific index#33485
crisbeto merged 1 commit into
angular:mainfrom
crisbeto:aria-listbox-goto

Conversation

@crisbeto

@crisbeto crisbeto commented Jul 3, 2026

Copy link
Copy Markdown
Member

Currently users are only able to programmatically focus the first option in a listbox which may not be enough for some cases.

These changes add a gotoIndex method that should be a bit more flexible.

Fixes #33483.

@crisbeto crisbeto requested a review from ok7sai July 3, 2026 07:21
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jul 3, 2026
@pullapprove pullapprove Bot requested a review from andrewseguin July 3, 2026 07:22
Comment thread src/aria/listbox/listbox.ts Outdated
Comment thread src/aria/listbox/listbox.ts Outdated
@crisbeto crisbeto force-pushed the aria-listbox-goto branch from dcd7145 to 9c4dcaa Compare July 3, 2026 12:17
Currently users are only able to programmatically focus the first option in a listbox which may not be enough for some cases.

These changes add a `gotoIndex` method that should be a bit more flexible.

Fixes angular#33483.
@crisbeto crisbeto force-pushed the aria-listbox-goto branch from 9c4dcaa to 55a7b72 Compare July 3, 2026 13:05
@crisbeto

crisbeto commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

I've addressed the feedback.

@ok7sai ok7sai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Alternatively we could add API on Option to set one as active, but I don't think that's any better than a centralized gotoIndex.

@crisbeto

crisbeto commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

I was leaning more towards having it on the listbox since it is the one tracking the active option.

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jul 3, 2026
@crisbeto crisbeto merged commit ee20441 into angular:main Jul 3, 2026
30 of 32 checks passed
@crisbeto

crisbeto commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

crisbeto added a commit that referenced this pull request Jul 3, 2026
Currently users are only able to programmatically focus the first option in a listbox which may not be enough for some cases.

These changes add a `gotoIndex` method that should be a bit more flexible.

Fixes #33483.

(cherry picked from commit ee20441)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: aria/listbox target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(aria/listbox): public API to set the active (highlighted) option on ngListbox

2 participants