Repository navigation
refactor: dialogs, menus, popovers and selects on bits-ui - #336
Merged
Merged
Conversation
Modal wraps the bits-ui Dialog and keeps its props. The language picker, the user menu, the event export menu, the notification popover and the theme select move from hand-rolled dropdowns with click-outside handlers and arrow-key code to bits-ui DropdownMenu, Popover and Select. The settings history dialog uses Modal instead of its own markup. runed, which bits-ui depends on, declares SvelteKit 2 as an optional peer, so npm nested a second SvelteKit with an old CommonJS cookie package that broke the build. An override points runed at our SvelteKit 3. Part of #327.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes
🚀 New features to boost your workflow:
|
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



First part of #327: the overlays. Tables, cards and buttons come next, then forms, mode-watcher, runed and splitting the big routes.
Dialogs, menus, popovers and selects now come from bits-ui, imported from npm and styled with our own Tailwind classes. shadcn-svelte was the other option, but it copies component source into the repo, and that's code we'd then own.
Modalwraps the bits-uiDialogand keeps its props, so its callers didn't change. The language picker, the user menu, the event export menu, the notification popover and the theme select drop their click-outside handlers, open flags and arrow-key code. The settings history dialog usesModalinstead of its own markup. Two classes in components.css,.floating-paneland.floating-item, style every menu surface and item, and the old modal and dropdown CSS is gone.The behaviour gains are focus trapping, scroll lock, focus returning to the opener, typeahead and submenus that work from the keyboard. Notification rows are real buttons now, and the Admin and Settings entries in the user menu are links.
runed, which bits-ui depends on, lists SvelteKit 2 as an optional peer. npm then nested a second SvelteKit with the CommonJS cookie 0.6, and the build failed on
parseCookie. An override in package.json points runed at our SvelteKit 3, sonpm lsshows one copy.Content in a bits-ui portal renders at the end of
document.body, so the tests query throughscreen. happy-dom lays nothing out, and bits-ui checks a click outside against the content's box, so those tests moved to the browser. The observer stubs in vitest.setup.ts became classes, since floating-ui constructs them withnew.Vitest passes 1040 tests with coverage at 95.35 / 78.6 / 95.05 / 95.9. Check, lint, stylelint, prettier and the build are clean. Against a local backend the Playwright suite passes 147 tests, and the 3 failures are the k3s-only execution tests. In Chrome, with no CSP violations or console errors:
Summary by cubic
Replaces the hand-rolled dialogs, menus, popovers and selects with bits-ui components styled with our own Tailwind classes. The gains are focus trapping, scroll lock, focus returning to the opener, typeahead and keyboard-driven submenus.
Modalwraps the bits-uiDialogand keeps its props, so its callers didn't change..floating-paneland.floating-itemclasses incomponents.cssreplace the old modal and dropdown CSS, the settings history dialog usesModal, notification rows become real buttons, and the Admin and Settings menu entries become links.runed, which bits-ui depends on, lists SvelteKit 2 as an optional peer, so npm nested a second SvelteKit with the CommonJS cookie 0.6 and the build failed onparseCookie; an override inpackage.jsonpointsrunedat our SvelteKit 3.document.body, so tests query throughscreenand the click-outside tests moved to the browser; the observer stubs invitest.setup.tsbecame classes because floating-ui constructs them withnew.Written for commit cada3fb. Summary will update on new commits.