This repository was archived by the owner on Sep 5, 2024. It is now read-only.
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.
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.
I don't understand why this is necessary. Invoking
focus
on an element should always trigger any event listeners to be called. @devversion can you explain?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.
The same question I asked myself too. But as I figured out,
focus()
can't be applied to all type of elements. And because the sidenav is a custom angular directive it looks like, they can't be focused through thefocus()
function. That's why I trigger that focus handlers manually, and its working perfect. In my other PR, which already got reviewed by Elad, I'm using the same strategy to get that running (see #5943).Quote MDN
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.
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.
Custom elements simply need a
tabindex
in order to receive focus:http://codepen.io/jelbourn/pen/MKYpJm?editors=101
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.
All right, thanks for that codepen demonstration.