-
Notifications
You must be signed in to change notification settings - Fork 198
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
Replace topbar dropdown menus working with JS by <details>
#1939
base: master
Are you sure you want to change the base?
Replace topbar dropdown menus working with JS by <details>
#1939
Conversation
6229c56
to
7f6ab08
Compare
Updated the selectors in the tests too. Ready for review now! :) |
Pressing escape works for closing all rustdoc modals. Having it mysteriously not work here would be confusing. |
Good point. I'll put this behaviour back. |
7f6ab08
to
177cf9e
Compare
The handling of the escape key to close the menu has been put back. |
I think it used to be the case that on mobile, clicking the crate dropdown would take you to the crate page, which has all the same functionality. I tested now and it doesn't - the whole menu opens, even on mobile. Does anyone remember changing that, intentionally or unintentionally? The current behavior is not great, because the menu won't fit well on all mobile screens, and doesn't make efficient use of space. At any rate, my vote is that we figure out why that's not happening on mobile and fix it, and also make that the behavior on no-JS browsers. Maintaining a whole interactive menu functionality that is supposed to work well both with and without JavaScript sounds like a high maintenance burden, particularly when we have a whole other page (the crate page) that we maintain for the express purpose of using it when the menu system is not available. |
I think #1081 did it, since it got rid of the old |
First, there should be no UI changes. I replaced the dropdown menus in the topbar with
<details>
instead which work nicely with keyboard events and don't require JS, hence why the JS reduced drastically. Another big advantage is that it'll be possible to collapse/expand menus even without JS (the position of the dropdown will be a bit less good but that's the only downside).There is one notable change though: in the current version of my changes, the ESCAPE and arrow keys don't work anymore. To expand/collapse a menu entry, you'll need to click on it or press ENTER/SPACE when it's focused.
With these changes, the JS is only here to prevent having two menus expanded at the same time and to still have the dropdown menu position working smoothly.
cc @Nemo157 @jsha