question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

♿ Router: Focus element after URL hash scroll into view navigation

See original GitHub issue

♿ 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:

Move the sequential focus navigation starting point to [the] target.

Describe the solution you’d like

Add a parameter for ExtraOptions as anchorFocus with the boolean type attached and false as the default

export interface ExtraOptions {
  ...
  anchorScrolling?: 'disabled' | 'enabled',
  anchorFocus?: boolean,
  ...
})

This could be achieved by dynamically setting a tabindex of '0' on the targeted element, focusing on that element, then setting the tabindex to '-1'. If a tabindex is already set to '0', then just focus on the element.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
tomasdevcommented, Oct 16, 2020

I would like this issue not to be auto-closed due to inactivity.

1reaction
zelliottcommented, Aug 13, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modify page scroll after url hash navigation is done
I am trying to use the following: $(document).ready(function(){ if(window.location.
Read more >
Where focus goes when following in page links - Hidde's blog
When you TAB after following the link, it does go to the next focusable thing from div#the-hague .
Read more >
State of CSS 2022 - web.dev
Scrolling ; Subgrid; Typography; Viewport units; Web compat. This is an exciting and ambitious list that I can't wait to see unfold.
Read more >
Hash link scroll functionality for React Router
This is a solution to React Router's issue of not scrolling to #hash-fragments when using the <Link> component to navigate. When you click...
Read more >
@mui/private-classnames | Yarn - Package Manager
React classnames utils used internally in the other MUI component libraries packages. changelog. Versions. 5.7.0. May 10, 2022. A ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found