-
-
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
NEXT: Overlay System (modals/drawers/toasts) #2357
Comments
Please consider including a means to disable the backdrop's click to close feature. The ARIA APG guidelines do allow for this, marking a dialog modal only when both:
|
Please move Modals away from the singleton pattern. |
Here's a proposal for implementing modals/drawers/popups/whatever: REPL While this does still use a "singleton" state under the hood, I'm sure this can be avoided. The idea is that, with snippets, it becomes extremely easy to just pass a snippet to a "openModal" function and it gets rendered. No modal store, no anything. This could then easily be refactored into a |
Thank you @rChaoz - this is somewhat similar to what I have in mind as well (namely how the state rune is used). I've been quietly working on a mixture of Popups and Modals this week, so I should have more to show for this per next week's regular update. Keep an eye out here or in our Discord The general idea is we're going to aim for the following:
But again, I'll plan to showcase my prototypes in next week's update. |
We've provided a more in-depth exploration of our proposal for Skeleton v3 popover and modals here:
We encourage feedback about the proposal be confined to the post linked above. |
Where did we land on not using the registry and just allowing users to simply use the components directly? |
I'll likely add a guide for integrating the native Note that we're using this approach as a temporary solution for our v3 doc search until we get a chance to integrate Floating UI. It should give you a good idea of what's possible: Source (NOTE: this is intermixed with a lot of PageFind search code): I might also encourage you to review the Popover API. It's now (finally) supported across all browsers after a recent Firefox rollout. Personally I find it more intuitive and friendlier than the Dialog: |
So Skeleton will default to the registry? If so, sad to hear. |
Something to consider is the push on progressive enhancement in the SvelteKit ecosystem (e.g., superforms, so it would be great if we could have a JS-less version for server-side rendering the modals and overlays. While popover API is nice, it is still only at 85% availability as of today. If we could get first-class support for dialog elements via tailwind utility classes than it would definitely further the progressive enhancement of Skeleton. However, totally understand that everyone is deep underway in this work. |
@jhechtf sorry for the late reply, but the registry system will be the right approach for a "system". Remember the goal is a universal queue globally scoped throughout your app. If you're just aiming for a quick one-off, the native @TweedChristian you've touched on a few topics here, so let me break this down...
Thanks for your feedback though! And obviously keep an eye out for more updates in the future. |
@endigo9740 I greatly disagree with your decision and am immensely disappointed. I hope we will still be able to make our own modals that fit within the Skeleton system as we are now as your previous system did not work for me. |
Quick update here - I'm in the process of researching modal options for Skeleton v3 and wanted to share that even fi we go all in on the "queue system", the browser native Kapture.2024-10-09.at.15.49.07.mp4Here's the code used to test: <div class="w-full">
<!-- Dialog -->
<dialog
data-modal
class="modal rounded-container bg-surface-100-900 text-inherit max-w-[640px] p-4 space-y-4 z-10 backdrop:bg-surface-50/75 dark:backdrop:bg-surface-950/75"
>
<h2 class="h3">Example</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
<form method="dialog" class="flex justify-end">
<button type="button" class="btn preset-tonal" data-modal-close>Close</button>
</form>
</dialog>
<!-- Interface -->
<div class="flex justify-center items-center">
<!-- Trigger -->
<button class="btn preset-filled" data-modal-show>Open Modal</button>
</div>
</div>
<script is:inline>
// DOM Elements
const elemModal = document.querySelector('[data-modal]');
const elemTrigger = document.querySelector('[data-modal-show]');
const elemClose = document.querySelector('[data-modal-close]');
// Listeners
elemTrigger.addEventListener('click', () => elemModal.showModal());
elemClose.addEventListener('click', () => elemModal.close());
</script>
<style>
.modal,
.modal::backdrop {
--anim-duration: 250ms;
transition:
display var(--anim-duration) allow-discrete,
overlay var(--anim-duration) allow-discrete,
opacity var(--anim-duration);
opacity: 0;
}
/* Animate In */
.modal[open],
.modal[open]::backdrop {
opacity: 1;
}
/* Animate Out */
@starting-style {
.modal[open],
.modal[open]::backdrop {
opacity: 0;
}
}
</style> Note that there's various ways to approach defining the DOM references and for handling the animations. In a more flushed out example I'd probably use transition-behavior as I expect it'll have the best cross-browser support long term. This would serve as a progress enhancement, meaning it only displays animations when the browser support the feature. But everything here is using a mix of Skeleton v3 primitive styles + Tailwind-specific variants such as I'll continue testing this over the next couple weeks though and when we settle on our solution I'll share more in public announcements. |
Please, consider getting away from singleton patterns. They seems cool but are very painful to use, also Svelte kit shallow routing is very important on android mobile devices and is difficult to manage on singleton patterns. Also, focus trap on skeleton 2 is making some components to render user-agent outline which is a very bad orange color in some cases, absolutely odd to the rest of the UI system. (I know is an ARIA standard... but it should be optional) Thanks for all your time and effort, Skeleton is VERY good and simple to use in general 💯 |
I'll be posting a new Discussions announcement tomorrow that details our solutions for Modals in v3. Anyone wishing to move away from the Singleton-based approach should be please with the new offering! Please also refer to this PR and the new Popover Integrations section within the v3 docs. Additionally, please refer to this post regarding Toasts, which will be split off to a new dedicated component. Full details can be found in the linked post. Finally, note that work on Floating UI Svelte will continue beyond the Skeleton v3 launch. Progress for that should be tracked on GitHub. |
This will act as a hub to centralize for this information.
Proposal
Maintainer Requests
The following requests are coming straight from the Skeleton team. These are highly likely be implemented:
Community Requests
The following requests have come from the community and are under consideration:
Enter
key pressed #1757<dialog>
element #2409Bugs and Issues
Resources:
<dialog>
element:Feedback
If you have additional updates or requests for this feature, please do so in the comments section below.
The text was updated successfully, but these errors were encountered: