Conversation
d5ff504 to
858d62a
Compare
| } | ||
| this.applyAttributeValue('tabindex', newTabIndex); | ||
| const nativeElement = this.el.nativeElement as HTMLElement; | ||
| if (newTabIndex !== null) { |
There was a problem hiding this comment.
The goal was to retain the current behavior in g3 and this has changed it. This PR should have only 2 things in it. The addition of ADD_TABINDEX_TO_NON_ANCHOR_ELEMENTS const and the early return on that const in this function. The rest will be left for cleanup if/when we can land it internally as well.
There was a problem hiding this comment.
Thanks for review, I was waiting for your opinion, updated the code with a minimal change
858d62a to
ec182f8
Compare
ec182f8 to
33ac75e
Compare
|
Can we also add a note to this that mentions simply adding the tabindex wasn't ever even enough to be correct for a11y anyways? It makes the link focusable but you can't hit enter and have it navigate because there's only a click listener. So to that extent, I don't know how breaking this really is in the end. |
RouterLink set `tabindex="0"` on every non-anchor element it was put on. There was no way to opt out, other than writing a tabindex attribute in the template yourself. The behavior now sits behind `ADD_TABINDEX_TO_NON_ANCHOR_ELEMENTS`, a module-level const. It is `false` in the published package and stays `true` inside Google while internal callers migrate off it. BREAKING CHANGE: RouterLink no longer adds `tabindex="0"` to non-anchor elements, such as `<div routerLink>` or `<button routerLink>`. If you want such an element in the tab order, put `tabindex="0"` on it in the template. Not much is lost here. That tabindex never made the element accessible anyway. RouterLink only listens for clicks, so a focused `<div routerLink>` did nothing when you pressed Enter. Anyone relying on it already had to add their own keyboard handling to make the element work. Fixes angular#28345
33ac75e to
cbdd707
Compare
done |
RouterLink set
tabindex="0"on every non-anchor element it was put on.There was no way to opt out, other than writing a tabindex attribute in
the template yourself.
The behavior now sits behind
ADD_TABINDEX_TO_NON_ANCHOR_ELEMENTS, amodule-level const. It is
falsein the published package and staystrueinside Google while internal callers migrate off it.BREAKING CHANGE: RouterLink no longer adds
tabindex="0"to non-anchorelements, such as
<div routerLink>or<button routerLink>. If youwant such an element in the tab order, put
tabindex="0"on it in thetemplate.
Not much is lost here. That tabindex never made the element accessible
anyway. RouterLink only listens for clicks, so a focused
<div routerLink>did nothing when you pressed Enter. Anyone relying on it already had to
add their own keyboard handling to make the element work.
Fixes #28345