-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Make Menus useable without JavaScript #966
Comments
We're currently in the process of doing a polishing pass on our utility features here and you're certainly welcome to chime in with your enhancement proposal there. If your use case is that the user doesn't have JavaScript, Skeleton is probably not the right component library for you. Especially our more advanced features like Utilities and some components rely on it because they rely on Svelte Component logic working. My initial reaction might be wrong though and it could easily fit the Menu, @endigo9740 will have to decide that. |
Progressive enhancement is a big part of sveltekit. Not supporting it in a UI library is a pretty big limitation. |
And for most features it'll work. I'm just not sure if it's possible or useful in a dynamic thing like a menu, honestly. |
That's fair! I just think it's something that should be considered where possible. In this case, yeah, probably not. I've implemented css only menus, and they're not fun 😅 |
It's definitely considered, of that I'm pretty sure! At least for me it's also part of the reason for the Elements/Components/Utilities split. I was mostly trying to say that if you're in an environment where users not having JS is the default, you might want to be careful when using Skeleton cause there's definitely things that aren't going to work. Edited the initial comment for hopefully a bit more clarity. |
Since SvelteKit makes it relatively easy to build more accessible websites, it would be great if Skeleton would support that whenever possible. As you said, a lot of the Skeleton features already work without JS. Some things just need JS and that is fine. I believe that it should be possible to create basic menus that do not require JS but are enhanced with JS to offer a smooth experience. |
So I've been doing web dev and frontend design for a couple decades at this point, but I can tell you, anchored popup overlays are one of the hardest features to get right. At least for me. I realize our menus and tooltips leave a bit to be desired, which is why I added this as one of the primary goals for the Utility polish pass: Per: Joking aside, my top priority is making these features work well. As in they're easy to setup, they are visually appealing (transitions, etc), and most importantly they're accessible. While yes, it's possible to set these up with pure CSS, the accessibility is usually the trade-off. You just straight up cannot setup keyboard interaction such as tapping ESC to close with pure HTML/CSS. Not to go off on a rant, but the number of folks working in an environment where JS is not enable is slim. I'm not saying it doesn't happen, and there's not some folks opting to turn off JS manually. But in my opinion it's a novelty. It's not the norm by any stretch of the imagination. Whereas a11y affects everyone, whether you're disabled or not. Everyone likes to be able to tap a key and dismiss a menu for example. Given that I don't think this will be a priority for us. I appreciate the suggestion, but unfortunately that's not the path we're treading. If you wish to create non-JS menus, you may need to do so yourself. Here's a quick visualization:
The tricky bit is the hover/click. Essentially you have to use CSS to control the siblings:
There are special Tailwind "group" selectors for controlling this: For now I think this suggestion is out of scope for us, so I'm going to close it. But feel free to reach out on our Discord if you need help setting up a pure CSS alternative. We may be able to help if time allows. |
Maybe I worded that poorly 😅. I did not mean to fully replace the current menu with a pure CSS alternative that has the exact same accessibility without JS. Much rather, I meant that we still let the But it is understandable if you do not want to mess with that since the whole reason why I use UI libraries is because I hate CSS and all the pain it brings 😅 |
There is no fallback though - you have to purposely build for CSS or JS. They are not really interchangeable like that. That said, we might could build some Tailwind > Presentation styles for this in the future, give it's all possible with HTML/CSS. This would be similar to the Gradient Headings now. Canned styles we provide for you to use as you see fit. |
Describe what feature you'd like. Pseudo-code, mockups, or screenshots of similar solutions are encouraged!
Currently, Menus rely on Svelte Actions, but this is causing them to break when the client does not have access to JavaScript for whatever reason.
This would not be an issue if Menus would purely use HTML and CSS to provide basic functionality. If JS is available, then
use:menu
can take over.2023-02-14.12-25-56.mp4
The first menu is copied from the docs, while the second one is based on the checkbox version of this example I found and thus works the same without JS enabled.
What type of pull request would this be?
Enhancement
Any links to similar examples or other references we should review?
No response
The text was updated successfully, but these errors were encountered: