-
Notifications
You must be signed in to change notification settings - Fork 24.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
♿ Router: Focus element after URL hash scroll into view navigation #30067
Comments
Hey can I work this issue? |
hey im not gonna take on this issue |
This is one of the issues I'm tackling in https://github.com/oaf-project/oaf-angular-router |
Thanks for the issue. This would be a good one to get fixed. Thanks for taking a look @danielnixon . |
Quickly chiming in, I don't think the proposed solution (reproduced below) is what we want:
We don't want to set focus on the target element, we want to move the sequential focus navigation starting point to the target. There's likely some logic in Angular's router (I'm super unfamiliar with Angular's router) that's preventing the browser from correctly doing this. |
Sorry, I misread the spec, thanks. However, after reading the spec, I still don't think the proposed solution is quite what we want. The target element should not be focused. Instead, it should have the focusing steps run on it. The difference is that if the target element is not focusable, it is not focused. Maybe a bit pedantic, but thought it'd be worth clarifying here. |
This comment has been minimized.
This comment has been minimized.
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid), we should attempt to set the browser focus after scrolling to a fragment. Note that this change does not exactly follow the robust steps outlined in the spec by finding a fallback target if the original is not focusable. Instead, we simply attempt to focus the element by calling `focus` on it, which will do nothing if the element is not focusable. fixes angular#30067
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid), we should attempt to set the browser focus after scrolling to a fragment. Note that this change does not exactly follow the robust steps outlined in the spec by finding a fallback target if the original is not focusable. Instead, we simply attempt to focus the element by calling `focus` on it, which will do nothing if the element is not focusable. fixes angular#30067
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid), we should attempt to set the browser focus after scrolling to a fragment. Note that this change does not exactly follow the robust steps outlined in the spec by finding a fallback target if the original is not focusable. Instead, we simply attempt to focus the element by calling `focus` on it, which will do nothing if the element is not focusable. fixes angular#30067
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid), we should attempt to set the browser focus after scrolling to a fragment. Note that this change does not exactly follow the robust steps outlined in the spec by finding a fallback target if the original is not focusable. Instead, we simply attempt to focus the element by calling `focus` on it, which will do nothing if the element is not focusable. fixes angular#30067
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid), we should attempt to set the browser focus after scrolling to a fragment. Note that this change does not exactly follow the robust steps outlined in the spec by finding a fallback target if the original is not focusable. Instead, we simply attempt to focus the element by calling `focus` on it, which will do nothing if the element is not focusable. fixes angular#30067
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid), we should attempt to set the browser focus after scrolling to a fragment. Note that this change does not exactly follow the robust steps outlined in the spec by finding a fallback target if the original is not focusable. Instead, we simply attempt to focus the element by calling `focus` on it, which will do nothing if the element is not focusable. fixes angular#30067
According to the [spec](https://html.spec.whatwg.org/#scroll-to-fragid), we should attempt to set the browser focus after scrolling to a fragment. Note that this change does not exactly follow the robust steps outlined in the spec by finding a fallback target if the original is not focusable. Instead, we simply attempt to focus the element by calling `focus` on it, which will do nothing if the element is not focusable. fixes #30067 PR Close #40241
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. |
♿ feature request
Add a flag for the Router Module to accept a flag to enable focusing of the element to which it is scrolled. In a previous issue (#6595) it was discussed that a feature request is needed to handle this issue.
This feature is required for Accessibility to work properly.
Relevant Package
@angular/router/ExtraOptions
Description
This feature is required for Accessibility to work properly. The
anchorScrolling
router option works...however, according to the HTML Standard Spec, Navigate to a Fragment, the last step is:Describe the solution you'd like
Add a parameter for ExtraOptions as
anchorFocus
with the boolean type attached and false as the defaultThis could be achieved by dynamically setting a
tabindex
of'0'
on the targeted element, focusing on that element, then setting thetabindex
to'-1'
. If atabindex
is already set to'0'
, then just focus on the element.The text was updated successfully, but these errors were encountered: