Skip to content
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

Why does Router render a div in the DOM? #270

Closed
florian-bd opened this issue May 8, 2019 · 3 comments
Closed

Why does Router render a div in the DOM? #270

florian-bd opened this issue May 8, 2019 · 3 comments

Comments

@florian-bd
Copy link

You can see that in the examples:

<div tabindex="-1" role="group" style="outline: none;"><div><h2>Welcome</h2></div></div>

Why is that? This makes it harder to layout

@florian-bd florian-bd changed the title Why does Router renders a div in the DOM? Why does Router render a div in the DOM? May 8, 2019
@marina-workco
Copy link

The accessibility tools are not aware of the changing routes on SPA so it looses focus while transitioning. This library adds one more div wrapper that returns focus to the beginning of the page as it was refreshed. You can find similar solutions here remix-run/react-router#5210

@florian-bd
Copy link
Author

Ok, interesting!
Thank you for answering :)

@TroyWolf
Copy link

If I understand the accessibility issue correctly, why would we ever need more than one of those extra DIV layers in our app? I am seeing one added for every nesting level in my routes. If I'm on a page that is nested 2 layers into my Router, I have 3 of those injected divs.

Screenshot from 2020-11-19 13-50-23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants