-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(dialog): not moving focus to container if autoFocus is disabled and focus was moved from a different component #16221
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
Merged
mmalerba
merged 1 commit into
angular:master
from
crisbeto:16215/dialog-menu-focus-shift
Jun 11, 2019
Merged
fix(dialog): not moving focus to container if autoFocus is disabled and focus was moved from a different component #16221
mmalerba
merged 1 commit into
angular:master
from
crisbeto:16215/dialog-menu-focus-shift
Jun 11, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nd focus was moved from a different component Given an example where we have a `mat-menu` that opens a dialog with `autoFocus = false`, the user's focus will end up on the menu's trigger, rather than the dialog container. This is due to the fact that we move focus to the dialog container immediately when the opening sequence starts and we assume that it's going to stay there. This isn't a problem when `autoFocus` is enabled, because we also try to move focus once the animation is done. These changes add an extra call after the animation finishes to ensure that the container has focus. Fixes angular#16215.
jelbourn
approved these changes
Jun 7, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
crisbeto
added a commit
to crisbeto/material2
that referenced
this pull request
Jun 14, 2019
… inside the dialog This is a follow-up to angular#16221. What we hadn't accounted for in the aforementioned PR is that the consumer may have turned off `autoFocus` so that they can handle it themselves and with our changes focus would be reset back to the container. These changes add an extra check which will ensure that focus is only moved if it's not inside the dialog already.
RudolfFrederiksen
pushed a commit
to RudolfFrederiksen/material2
that referenced
this pull request
Jun 21, 2019
…nd focus was moved from a different component (angular#16221) Given an example where we have a `mat-menu` that opens a dialog with `autoFocus = false`, the user's focus will end up on the menu's trigger, rather than the dialog container. This is due to the fact that we move focus to the dialog container immediately when the opening sequence starts and we assume that it's going to stay there. This isn't a problem when `autoFocus` is enabled, because we also try to move focus once the animation is done. These changes add an extra call after the animation finishes to ensure that the container has focus. Fixes angular#16215.
andrewseguin
pushed a commit
that referenced
this pull request
Jun 26, 2019
… inside the dialog (#16297) This is a follow-up to #16221. What we hadn't accounted for in the aforementioned PR is that the consumer may have turned off `autoFocus` so that they can handle it themselves and with our changes focus would be reset back to the container. These changes add an extra check which will ensure that focus is only moved if it's not inside the dialog already.
crisbeto
added a commit
to crisbeto/material2
that referenced
this pull request
Jul 1, 2019
…bled and focus was moved while animating These changes incorporate angular#16297 and angular#16221 into the bottom sheet since it follows a similar focus capturing behavior to `MatDialogContainer`. They ensure that focus is on the bottom sheet container when the animation is over, because it could've moved while we were animating. It also has an extra check to ensure that we don't move focus unnecessarily if the consumer decided to move focus themselves somewhere within the bottom sheet.
andrewseguin
pushed a commit
that referenced
this pull request
Jul 2, 2019
…nd focus was moved from a different component (#16221) Given an example where we have a `mat-menu` that opens a dialog with `autoFocus = false`, the user's focus will end up on the menu's trigger, rather than the dialog container. This is due to the fact that we move focus to the dialog container immediately when the opening sequence starts and we assume that it's going to stay there. This isn't a problem when `autoFocus` is enabled, because we also try to move focus once the animation is done. These changes add an extra call after the animation finishes to ensure that the container has focus. Fixes #16215.
andrewseguin
pushed a commit
that referenced
this pull request
Jul 2, 2019
… inside the dialog (#16297) This is a follow-up to #16221. What we hadn't accounted for in the aforementioned PR is that the consumer may have turned off `autoFocus` so that they can handle it themselves and with our changes focus would be reset back to the container. These changes add an extra check which will ensure that focus is only moved if it's not inside the dialog already.
crisbeto
added a commit
to crisbeto/material2
that referenced
this pull request
Jul 3, 2019
…is disabled and focus was moved while animating These changes incorporate angular#16297 and angular#16221 into the experimental dialog since it follows a similar focus capturing behavior to `MatDialogContainer`. They ensure that focus is on the dialog container container when the animation is over, because it could've moved while we were animating. It also has an extra check to ensure that we don't move focus unnecessarily if the consumer decided to move focus themselves somewhere within the container.
jelbourn
pushed a commit
that referenced
this pull request
Jul 9, 2019
…is disabled and focus was moved while animating (#16446) These changes incorporate #16297 and #16221 into the experimental dialog since it follows a similar focus capturing behavior to `MatDialogContainer`. They ensure that focus is on the dialog container container when the animation is over, because it could've moved while we were animating. It also has an extra check to ensure that we don't move focus unnecessarily if the consumer decided to move focus themselves somewhere within the container.
jelbourn
pushed a commit
that referenced
this pull request
Jul 17, 2019
…bled and focus was moved while animating These changes incorporate #16297 and #16221 into the bottom sheet since it follows a similar focus capturing behavior to `MatDialogContainer`. They ensure that focus is on the bottom sheet container when the animation is over, because it could've moved while we were animating. It also has an extra check to ensure that we don't move focus unnecessarily if the consumer decided to move focus themselves somewhere within the bottom sheet.
jelbourn
pushed a commit
that referenced
this pull request
Jul 19, 2019
…bled and focus was moved while animating (#16418) These changes incorporate #16297 and #16221 into the bottom sheet since it follows a similar focus capturing behavior to `MatDialogContainer`. They ensure that focus is on the bottom sheet container when the animation is over, because it could've moved while we were animating. It also has an extra check to ensure that we don't move focus unnecessarily if the consumer decided to move focus themselves somewhere within the bottom sheet.
andrewseguin
pushed a commit
that referenced
this pull request
Jul 29, 2019
…bled and focus was moved while animating (#16418) These changes incorporate #16297 and #16221 into the bottom sheet since it follows a similar focus capturing behavior to `MatDialogContainer`. They ensure that focus is on the bottom sheet container when the animation is over, because it could've moved while we were animating. It also has an extra check to ensure that we don't move focus unnecessarily if the consumer decided to move focus themselves somewhere within the bottom sheet.
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.
Labels
action: merge
The PR is ready for merge by the caretaker
cla: yes
PR author has agreed to Google's Contributor License Agreement
P2
The issue is important to a large percentage of users, with a workaround
target: patch
This PR is targeted for the next patch release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Given an example where we have a
mat-menu
that opens a dialog withautoFocus = false
, the user's focus will end up on the menu's trigger, rather than the dialog container. This is due to the fact that we move focus to the dialog container immediately when the opening sequence starts and we assume that it's going to stay there. This isn't a problem whenautoFocus
is enabled, because we also try to move focus once the animation is done. These changes add an extra call after the animation finishes to ensure that the container has focus.Note: I wasn't able to capture this properly in a unit test, because we need to be able to flush a
Promise.resolve
, followed by some logic which is then followed by flushing the animations. The problem is that I always ended up flushing the promise and the animations at the same time.Fixes #16215.