Skip to content

fix(material/list): set initial focus on first selected option in selection list - #23092

Merged
andrewseguin merged 1 commit into
angular:masterfrom
crisbeto:22675/selection-list-initial-focus
Jul 2, 2021
Merged

fix(material/list): set initial focus on first selected option in selection list#23092
andrewseguin merged 1 commit into
angular:masterfrom
crisbeto:22675/selection-list-initial-focus

Conversation

@crisbeto

Copy link
Copy Markdown
Member

Currently when a selection list receives focus, it forwards it either to the option that the user interacted with last or the first option in the list. This goes against the a11y best practices and is weird when there the user lands on the list for the first time and it has preselected options.

These changes switch to focusing the first selected option and falling back to the first option. This is consistent with the MDC implementation as well.

Fixes #22675.

…ection list

Currently when a selection list receives focus, it forwards it either to the option that the user interacted with last or the first option in the list. This goes against the a11y best practices and is weird when there the user lands on the list for the first time and it has preselected options.

These changes switch to focusing the first selected option and falling back to the first option. This is consistent with the MDC implementation as well.

Fixes angular#22675.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent Accessibility This issue is related to accessibility (a11y) target: patch This PR is targeted for the next patch release labels Jun 30, 2021
@crisbeto
crisbeto requested a review from jelbourn June 30, 2021 07:25
@crisbeto
crisbeto requested a review from devversion as a code owner June 30, 2021 07:25
@crisbeto
crisbeto requested a review from a team June 30, 2021 07:25
@google-cla google-cla Bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 30, 2021

@jelbourn jelbourn 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.

LGTM

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Jun 30, 2021
@andrewseguin
andrewseguin merged commit c571da6 into angular:master Jul 2, 2021
andrewseguin pushed a commit that referenced this pull request Jul 2, 2021
…ection list (#23092)

Currently when a selection list receives focus, it forwards it either to the option that the user interacted with last or the first option in the list. This goes against the a11y best practices and is weird when there the user lands on the list for the first time and it has preselected options.

These changes switch to focusing the first selected option and falling back to the first option. This is consistent with the MDC implementation as well.

Fixes #22675.

(cherry picked from commit c571da6)
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Accessibility This issue is related to accessibility (a11y) action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(SelectionList): Focus order for multi-select list is not set correctly

4 participants