-
Notifications
You must be signed in to change notification settings - Fork 423
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
Modal component is relying too much on Javascript #458
Comments
Until then I had used |
Great demo
@Atmos4, I love it. Let's also add |
Nice I will start working on that then!
See my comment on the previous issue about the limits of |
There is one issue with this @lucaslarroche: if I want closing transitions to display properly, I need to always have This can be fixed with In my opinion it's still an upgrade from the current CSS behavior, and |
I'm doing this and it works perfectly (except for click outside to close). Might be worth sharing it in the docs: <dialog id="modal">
<article>
<header>
<button aria-label="Close" rel="prev" onclick="modal.close()"></button>
</header>
<p>...</p>
</article>
</dialog>
<button onclick="modal.showModal()">Open Modal</button> |
@pietz This is fine, but you will never have closing animations displaying properly... unless you always display the modal, which makes it always focusable (see my previous comment). |
@Atmos4 That's true and I don't really care if it's added to the docs or not. However, given Picos philosophy and design principles, I think that my provided solution is the closest to what the average PicoCSS user expects to see: Preferring very simple HTML-only solutions that might miss a feature or two over complex or cryptic feature complete solutions. I might be wrong though :) |
@pietz I think we pretty much agree on most things here :) see the demo link I posted in the issue, it looks like your solution regarding JS is roughly the same as mine. I will publish a PR about the animations and changes to the modal. I can try to update the docs too :) |
FYI here is the related PR - #503 |
Currently there is a strong dependency on Javascript with the modal component, especially with animations and disabling scroll. Both can be done with pure CSS instead.
Animations can be done with CSS transitions
Disabling scroll can be achieved with CSS
:has
pseudo-class.:has
is relatively new in terms of browser support, but it seems to be used in the codebase already so it's probably not a concern.Here is a link to the demo on CodePen.
Let me know what you think. If you like the idea, I can submit a PR.
The text was updated successfully, but these errors were encountered: