Skip to content

Workaround for keyboard scrolling #579

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

Merged
merged 2 commits into from
Feb 2, 2020
Merged

Conversation

Zexbe
Copy link
Contributor

@Zexbe Zexbe commented Feb 1, 2020

Works around keyboard not scrolling on crate docs pages (without clicking)

Alternate solution to:
#498
#510

Works around keyboard not scrolling on load (without clicking)
@jyn514
Copy link
Member

jyn514 commented Feb 1, 2020

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

This is much simpler indeed. However, I'm not sure how much we can rely on it. If we don't have any other "taxindex", I think this is the best solution currently proposed. However, I wonder if we shouldn't have a JS solution "in case" this one doesn't work at some point. What do you think?

@Zexbe
Copy link
Contributor Author

Zexbe commented Feb 1, 2020

Someone would have to change something for it not to work. That would be a unit tests job to prevent, which I don’t know how to make for this. This may fail in some unknown case, but it currently fails in all cases. Unless it is merged though, nobody is going to use it, so that unknown case will never be reported. Unless we get an example that it fails at, building a script that tries to detect, and correct it probably won’t work.

@jyn514
Copy link
Member

jyn514 commented Feb 1, 2020

Can we use autofocus on a div? Or maybe use a #rustdoc hash in the URL so it's in focus? https://stackoverflow.com/a/3656569

@jyn514
Copy link
Member

jyn514 commented Feb 1, 2020

I think we shouldn't add JS until we need to, I agree with @Zexbe that this should be caught by a unit test, not by two pieces of code that do the same thing.

@jyn514
Copy link
Member

jyn514 commented Feb 2, 2020

Have you tried this with JavaScript disabled? I think tabindex=-1 will prevent it from being selected with the keyboard.

@Zexbe
Copy link
Contributor Author

Zexbe commented Feb 2, 2020

@jyn514 I am able to navigate with tab on the docs page with javascript disabled. -1 only controls the div, and a div cannot be tabbed to by default.

@jyn514 jyn514 merged commit 9164b48 into rust-lang:master Feb 2, 2020
@Zexbe Zexbe deleted the scroll-workaround branch February 2, 2020 06:57
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

Successfully merging this pull request may close these issues.

3 participants