-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(sidenav): restore focus if drawer is closed through backdrop click #19534
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(sidenav): restore focus if drawer is closed through backdrop click #19534
Conversation
47c1ca9
to
956f80f
Compare
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
Currently we do not restore focus properly when a drawer is closed through backdrop click. This is because we only restore focus when an element inside the drawer is focused before closing. This is not the case when the backdrop is clicked, as the focus is usually redirected to the `document.body` element. Fixes angular#17749.
956f80f
to
70474dc
Compare
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
} else { | ||
this._elementRef.nativeElement.blur(); | ||
} | ||
// Note that we don't check via `instanceof HTMLElement` so that we can cover SVGs as well. |
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.
Nice, this is definitely easier to understand with the helper broken out
#19534) Currently we do not restore focus properly when a drawer is closed through backdrop click. This is because we only restore focus when an element inside the drawer is focused before closing. This is not the case when the backdrop is clicked, as the focus is usually redirected to the `document.body` element. Fixes #17749.
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. |
Currently we do not restore focus properly when a drawer is closed
through backdrop click. This is because we only restore focus when
an element inside the drawer is focused before closing. This is not
the case when the backdrop is clicked, as the focus is usually
redirected to the
document.body
element.Fixes #17749.