-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
MatButton.focus ignores origin argument #17174
Comments
devversion
added a commit
to devversion/material2
that referenced
this issue
Sep 24, 2019
It looks like `MatButton` at some point has been refactored to implement the `FocusableOption` interface so that it can be used easily iǹ the `FocusKeyManager`. Currently since the `origin` parameter in the `focus` method is not respected, the `FocusKeyManager#setFocusOrigin` method is a noop for button elements. Additionally consumers of `MatButton` who pass in a specific `FocusOrigin` when calling the `focus` method will be surprised that the `origin` is simply ignored (even though it's part of the public method signature; just prefixed with an underscore). We should just respect the focus origin to make the method less confusing and to properly implement the `FocusableOption`. Fixes angular#17174
devversion
added a commit
to devversion/material2
that referenced
this issue
Sep 24, 2019
It looks like `MatButton` at some point has been refactored to implement the `FocusableOption` interface so that it can be used easily in the `FocusKeyManager`. Currently since the `origin` parameter in the `focus` method is not respected, the `FocusKeyManager#setFocusOrigin` method is a noop for button elements. Additionally consumers of `MatButton` who pass in a specific `FocusOrigin` when calling the `focus` method will be surprised that the `origin` is simply ignored (even though it's part of the public method signature; just prefixed with an underscore). We should just respect the focus origin to make the method less confusing and to properly implement the `FocusableOption`. Fixes angular#17174
andrewseguin
pushed a commit
that referenced
this issue
Sep 27, 2019
It looks like `MatButton` at some point has been refactored to implement the `FocusableOption` interface so that it can be used easily in the `FocusKeyManager`. Currently since the `origin` parameter in the `focus` method is not respected, the `FocusKeyManager#setFocusOrigin` method is a noop for button elements. Additionally consumers of `MatButton` who pass in a specific `FocusOrigin` when calling the `focus` method will be surprised that the `origin` is simply ignored (even though it's part of the public method signature; just prefixed with an underscore). We should just respect the focus origin to make the method less confusing and to properly implement the `FocusableOption`. Fixes #17174
andrewseguin
pushed a commit
that referenced
this issue
Sep 30, 2019
It looks like `MatButton` at some point has been refactored to implement the `FocusableOption` interface so that it can be used easily in the `FocusKeyManager`. Currently since the `origin` parameter in the `focus` method is not respected, the `FocusKeyManager#setFocusOrigin` method is a noop for button elements. Additionally consumers of `MatButton` who pass in a specific `FocusOrigin` when calling the `focus` method will be surprised that the `origin` is simply ignored (even though it's part of the public method signature; just prefixed with an underscore). We should just respect the focus origin to make the method less confusing and to properly implement the `FocusableOption`. Fixes #17174 (cherry picked from commit 1c307c8)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
MatButton
implementsFocusableOption
which implementsfocus(origin?: FocusOrigin)
. However, it actually implements justfocus(unused, extraArgumentsHere)
.Reproduction
Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-qrhvfh
Steps to reproduce:
MatButton
MatButton.focus(origin)
whereorigin = 'keyboard'|'mouse'|whatever
Expected Behavior
Focus should be via
'origin'
, and classcdk-origin-focused
should be appliedActual Behavior
Focus is always done via
'program'
andcdk-program-focused
is appliedWorkaround
Focus can be done via FocusMonitor instead.
Environment
The text was updated successfully, but these errors were encountered: