Compare commits

..
Author SHA1 Message Date
grugbraindev 605d332d1a Keep parent popovers open when a nested one opens
Opening a popover, dropdown menu, select or combobox closed every
other open one, including the popover it sits in. Only close the
ones that don't contain the source, like native popover=auto.
2026-10-23 09:53:43 +08:00
5 changed files with 4 additions and 30 deletions
-26
View File
@@ -70,32 +70,6 @@ Or load the Basecoat runtime once, then only the component scripts you use.
| `dist/js/basecoat.min.js` | Runtime only. Load once before individual component scripts. |
| `dist/js/{component}.min.js` | Individual JavaScript component file. |
### Tailwind utilities with the CDN
The CDN stylesheets only include the utilities Basecoat uses, so classes like `bg-primary` or `text-muted-foreground` are not available. If you add the [Tailwind Play CDN](https://tailwindcss.com/docs/installation/play-cdn) for utilities, map Basecoat's theme tokens to Tailwind colors and restore the border color after Tailwind's preflight. Load this after the Basecoat stylesheet.
```html
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<style type="text/tailwindcss">
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-border: var(--border);
}
@layer base {
*, ::before, ::after { border-color: var(--border); }
}
</style>
```
Add any other tokens you use the same way, for example `--color-destructive: var(--destructive);`. The Play CDN is meant for prototypes. For production, use the [Tailwind CLI with a bundle file](#npm) instead.
## NPM
<Steps>
+1 -1
View File
@@ -503,7 +503,7 @@
if (!root.contains(event.target)) root.close(false);
};
const handleDocumentPopover = (event) => {
if (event.detail.source !== root) root.close(false);
if (!root.contains(event.detail.source)) root.close(false);
};
state.input.addEventListener('focus', handleInputFocus);
+1 -1
View File
@@ -165,7 +165,7 @@
};
const handleDocumentPopover = (event) => {
if (event.detail.source !== root) root.close(false);
if (!root.contains(event.detail.source)) root.close(false);
};
state.trigger.addEventListener('click', handleTriggerClick);
+1 -1
View File
@@ -60,7 +60,7 @@
};
const handleDocumentPopover = (event) => {
if (event.detail.source !== popoverComponent) {
if (!popoverComponent.contains(event.detail.source)) {
closePopover(false);
}
};
+1 -1
View File
@@ -373,7 +373,7 @@
if (!root.contains(event.target)) root.close(false);
};
const handleDocumentPopover = (event) => {
if (event.detail.source !== root) root.close(false);
if (!root.contains(event.detail.source)) root.close(false);
};
state.trigger.addEventListener('keydown', handleTriggerKeydown);