Skip to content
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

fix(material/list): fix tabindex="-1" not being maintained when disabled #25860

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

zarend
Copy link
Contributor

@zarend zarend commented Oct 24, 2022

When entire list is disabled, avoid adding list options to the tab order in the following situations:

  • focusin event is triggered on an option. This can happen when the end user clicks on a list option.
  • ngOnInit happens when list is disabled
  • updating selection state

When list is disabled tabindex of every option should always be -1. Tabindex was set to 0 mainly because _resetActionOption only considered when list options where disabled, but didn't consider when the list itself is disabled.

Fix issues by setting tabindex to -1 when disabled and making _handleFocusin a noop when disabled.

@zarend zarend added Accessibility This issue is related to accessibility (a11y) area: material/list labels Oct 24, 2022
@devversion devversion removed their request for review October 25, 2022 13:15
When entire list is disabled, avoid adding list options to the tab order
in the following situations:
 - focusin event is triggered on an option. This can happen when the
   end user clicks on a list option.
 - ngOnInit happens when list is disabled
 - updating selection state

When list is disabled tabindex of every option should always be -1.
Tabindex was set to 0 mainly because `_resetActionOption` only considered when
list options where disabled, but didn't consider when the list itself is
disabled.

Fix issues by setting tabindex to -1 when disabled and making
`_handleFocusin` a noop when disabled.
@zarend zarend added the target: rc This PR is targeted for the next release-candidate label Oct 27, 2022
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM

@zarend zarend added the action: merge The PR is ready for merge by the caretaker label Oct 27, 2022
@zarend zarend merged commit 8304a94 into angular:main Oct 28, 2022
zarend added a commit that referenced this pull request Oct 28, 2022
…led (#25860)

When entire list is disabled, avoid adding list options to the tab order
in the following situations:
 - focusin event is triggered on an option. This can happen when the
   end user clicks on a list option.
 - ngOnInit happens when list is disabled
 - updating selection state

When list is disabled tabindex of every option should always be -1.
Tabindex was set to 0 mainly because `_resetActionOption` only considered when
list options where disabled, but didn't consider when the list itself is
disabled.

Fix issues by setting tabindex to -1 when disabled and making
`_handleFocusin` a noop when disabled.

(cherry picked from commit 8304a94)
@angular-automatic-lock-bot
Copy link

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 Nov 28, 2022
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 area: material/list target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants