You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/packages/toast.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,3 +125,34 @@ This catches toast-related bugs at build time, not at runtime.
125
125
|`show(props)`|`(props) => string`| Show a toast, returns unique ID |
126
126
|`hide(id)`|`(id: string) => void`| Remove a toast by ID |
127
127
|`ToastContainerComponent`|`Component`| Mount this in your app root |
128
+
129
+
## Top-Layer Behavior (0.2.0+)
130
+
131
+
The `ToastContainerComponent` promotes itself to the browser **top layer** via the [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) whenever at least one toast is queued. This keeps toasts visible above any open `<dialog>.showModal()` backdrop — without top-layer promotion, no `z-index` value can pierce a modal's stacking context.
132
+
133
+
The container declares `popover="manual"` and calls `.showPopover()` on the first toast / `.hidePopover()` after the last toast clears. Defensive try/catch guards swallow `InvalidStateError` so rapid show/hide cycles don't surface uncaught errors.
134
+
135
+
### CSS Specificity (Migration from 0.1.1)
136
+
137
+
The UA stylesheet applies `position: fixed; inset: 0; margin: auto; width: fit-content; height: fit-content` to any element matching `[popover]:popover-open` — selector specificity `(0,2,0)`. Consumer fallthrough classes like `.toast-stack { position: fixed; top: 1rem; right: 1rem }` (`(0,1,0)`) do **not** override these UA rules.
138
+
139
+
If you applied positioning via fallthrough classes in 0.1.1, raise selector specificity in 0.2.0 by qualifying with `[popover]`:
140
+
141
+
```css
142
+
/* Beats UA :popover-open */
143
+
[popover].toast-stack {
144
+
position: fixed;
145
+
top: 1rem;
146
+
right: 1rem;
147
+
inset: auto;
148
+
margin: 0;
149
+
width: auto;
150
+
height: auto;
151
+
}
152
+
```
153
+
154
+
`fs-toast` deliberately ships **no** inline `style` resets so consumer CSS retains full control.
155
+
156
+
### Browser Baseline
157
+
158
+
Popover API support: Chrome ≥ 114, Firefox ≥ 125, Safari ≥ 17. On older browsers the container's defensive try/catch swallows the missing-method error — toasts still render in normal DOM, just without top-layer promotion (so they will render below modal backdrops on those browsers).
Copy file name to clipboardExpand all lines: packages/toast/CHANGELOG.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,45 @@
1
1
# @script-development/fs-toast
2
2
3
+
## 0.2.0
4
+
5
+
### Minor Changes
6
+
7
+
- Promote `ToastContainerComponent` to the browser top layer via the [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) so toasts remain visible above `<dialog>.showModal()` backdrops (closes [#71](https://github.com/script-development/fs-packages/issues/71)). The container declares `popover="manual"` and calls `.showPopover()` when the queue gains its first toast / `.hidePopover()` when the queue empties. The single-root container output from 0.1.1 is preserved — fallthrough class/style attributes still land on the root `<div>`.
8
+
9
+
### Migration — CSS Specificity
10
+
11
+
The UA stylesheet applies the following rules to any element with `[popover]:popover-open`:
12
+
13
+
```css
14
+
[popover]:popover-open {
15
+
position: fixed;
16
+
inset: 0;
17
+
margin: auto;
18
+
width: fit-content;
19
+
height: fit-content;
20
+
}
21
+
```
22
+
23
+
The selector specificity is `(0,2,0)`. A consumer fallthrough class such as `.toast-stack { position: fixed; top: 1rem; right: 1rem }` (specificity `(0,1,0)`) does **not** override it. To restore custom positioning while a toast is queued, raise selector specificity by qualifying with `[popover]` or use `!important`:
24
+
25
+
```css
26
+
[popover].toast-stack {
27
+
position: fixed;
28
+
top: 1rem;
29
+
right: 1rem;
30
+
inset: auto;
31
+
margin: 0;
32
+
width: auto;
33
+
height: auto;
34
+
}
35
+
```
36
+
37
+
`fs-toast` deliberately ships **no** inline `style` resets — inline style would block consumer overrides entirely. Override at the CSS layer instead.
38
+
39
+
### Browser Baseline
40
+
41
+
The Popover API requires Chrome ≥ 114, Firefox ≥ 125, Safari ≥ 17. Older browsers fall through the container's defensive try/catch — the toast queue still renders, just without top-layer promotion (and therefore without modal coexistence).
0 commit comments