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(menu): always focus first menu item #9383

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

crisbeto
Copy link
Member

  • Switches to always focusing the first menu item, even when opening by mouse. The focus styling will only apply when focused by keyboard.
  • Adds the ability to set the focus origin through the FocusKeyManager.

Fixes #9252.

@crisbeto crisbeto added pr: needs review Accessibility This issue is related to accessibility (a11y) labels Jan 14, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 14, 2018
*/
focusFirstItem() {
this._keyManager.setFirstItemActive();
focusFirstItem(origin: FocusOrigin) {
Copy link
Member

Choose a reason for hiding this comment

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

Should this be option to avoid a breaking change?

super();

if (_focusMonitor) {
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment here like

// We want to show the focus style for menu items only when the focus was not caused by
// a mouse or touch interaction. 

?

@crisbeto
Copy link
Member Author

Addressed the feedback @jelbourn.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn
Copy link
Member

Actually it looks like CircleCI is raising a compilation error

@crisbeto
Copy link
Member Author

ops, it's sorted out now.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release and removed pr: needs review labels Jan 16, 2018
* Switches to always focusing the first menu item, even when opening by mouse. The focus styling will only apply when focused by keyboard.
* Adds the ability to set the focus origin through the `FocusKeyManager`.

Fixes angular#9252.
@jelbourn jelbourn merged commit 8430617 into angular:master Jan 23, 2018
crisbeto added a commit to crisbeto/material2 that referenced this pull request Jan 23, 2018
Fixes an e2e test that is failing after angular#9383.
jelbourn pushed a commit that referenced this pull request Jan 23, 2018
Fixes an e2e test that is failing after #9383.
tinayuangao pushed a commit that referenced this pull request Jan 24, 2018
Fixes an e2e test that is failing after #9383.
jelbourn pushed a commit to jelbourn/components that referenced this pull request Jan 29, 2018
Fixes an e2e test that is failing after angular#9383.
@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 Sep 8, 2019
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 target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mat-menu is acting differently when triggered via keyboard vs mouse
3 participants