@capagents/forgeqe 3.1.1 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/HOW_TO_USE.md +435 -78
  2. package/README.md +21 -6
  3. package/THIRD_PARTY_NOTICES.md +210 -1
  4. package/dist/docs-site/CREDITS.md +6 -0
  5. package/dist/docs-site/architecture-map/index.html +1 -1
  6. package/dist/docs-site/docs/app-theme.css +100 -8
  7. package/dist/docs-site/docs/architecture/index.html +210 -214
  8. package/dist/docs-site/docs/area-api/index.html +350 -0
  9. package/dist/docs-site/docs/area-automated-tests/index.html +967 -0
  10. package/dist/docs-site/docs/area-browser/index.html +430 -0
  11. package/dist/docs-site/docs/area-data/index.html +605 -0
  12. package/dist/docs-site/docs/area-desktop/index.html +755 -0
  13. package/dist/docs-site/docs/area-mobile/index.html +631 -0
  14. package/dist/docs-site/docs/area-operations/index.html +1069 -0
  15. package/dist/docs-site/docs/area-pull-requests/index.html +208 -0
  16. package/dist/docs-site/docs/area-quality/index.html +365 -0
  17. package/dist/docs-site/docs/area-release/index.html +320 -0
  18. package/dist/docs-site/docs/area-setup/index.html +1192 -0
  19. package/dist/docs-site/docs/area-systems/index.html +207 -0
  20. package/dist/docs-site/docs/area-test-cases/index.html +694 -0
  21. package/dist/docs-site/docs/containers/index.html +97 -104
  22. package/dist/docs-site/docs/cost-architecture/index.html +108 -112
  23. package/dist/docs-site/docs/custom-agents-first-run/index.html +19 -23
  24. package/dist/docs-site/docs/desktop/index.html +172 -162
  25. package/dist/docs-site/docs/desktop-ci/index.html +26 -33
  26. package/dist/docs-site/docs/evidence/index.html +253 -257
  27. package/dist/docs-site/docs/feature-test-prompts/index.html +66 -70
  28. package/dist/docs-site/docs/get-started/index.html +495 -0
  29. package/dist/docs-site/docs/graphify/index.html +42 -46
  30. package/dist/docs-site/docs/guardrails/index.html +17 -21
  31. package/dist/docs-site/docs/index.html +17 -6729
  32. package/dist/docs-site/docs/mobile/index.html +155 -162
  33. package/dist/docs-site/docs/model-routing/index.html +44 -51
  34. package/dist/docs-site/docs/overview/index.html +176 -0
  35. package/dist/docs-site/docs/product-graph/index.html +52 -55
  36. package/dist/docs-site/docs/product-knowledge/index.html +11 -15
  37. package/dist/docs-site/docs/product-views/index.html +53 -57
  38. package/dist/docs-site/docs/reference/index.html +379 -0
  39. package/dist/docs-site/docs/search.js +1 -1
  40. package/dist/docs-site/docs/using/index.html +480 -0
  41. package/dist/docs-site/docs/web-app/index.html +147 -93
  42. package/dist/docs-site/security/index.html +930 -0
  43. package/dist/docs-site/security/security-theme.css +161 -0
  44. package/dist/docs-site/security/security.js +1465 -0
  45. package/dist/docs-site/vendor/react-18.3.1.production.min.js +31 -0
  46. package/dist/docs-site/vendor/react-dom-18.3.1.production.min.js +267 -0
  47. package/dist/docs-site/vendor/reactflow-11.11.4.umd.js +10 -0
  48. package/dist/forgeqe.js +1902 -1895
  49. package/dist/web/THIRD_PARTY_NOTICES.md +0 -136
  50. package/dist/web/assets/Agent-CPhmZdFX.js +8 -0
  51. package/dist/web/assets/AgentWork-BXdN9xgi.js +2 -0
  52. package/dist/web/assets/ApiTests-Do3xLjfB.js +10 -0
  53. package/dist/web/assets/Browse-WVkJT6Bs.js +2 -0
  54. package/dist/web/assets/Chat-CDc9UcQX.js +3 -0
  55. package/dist/web/assets/CommandPalette-BAZm62lV.js +1 -0
  56. package/dist/web/assets/Compare-Br6n9T9L.js +1 -0
  57. package/dist/web/assets/Cost-BBUyBu3Y.js +1 -0
  58. package/dist/web/assets/Data-Ch2DPEWp.js +6 -0
  59. package/dist/web/assets/Desktop-Qzoq-cQv.js +1 -0
  60. package/dist/web/assets/DesktopReview-CF_jQYAM.js +1 -0
  61. package/dist/web/assets/Evidence-C72Lj5_Q.js +1 -0
  62. package/dist/web/assets/Explore-ObkEpUyS.js +2 -0
  63. package/dist/web/assets/Features-CQzNo_WP.js +1 -0
  64. package/dist/web/assets/Flags-0-RniPJm.js +2 -0
  65. package/dist/web/assets/Flaky-BPJvNLCA.js +1 -0
  66. package/dist/web/assets/Impact-CfccsL_k.js +3 -0
  67. package/dist/web/assets/Jobs-T6m4zhDy.js +5 -0
  68. package/dist/web/assets/KindPage-BDUvWe2p.js +6 -0
  69. package/dist/web/assets/Migration-Dqeh4x5u.js +2 -0
  70. package/dist/web/assets/PageAgent-DNjzIgeY.js +1 -0
  71. package/dist/web/assets/Product-nYV_scOV.js +7 -0
  72. package/dist/web/assets/Production-CGSbEWVa.js +1 -0
  73. package/dist/web/assets/Quality-BIypojZm.js +1 -0
  74. package/dist/web/assets/Readiness-BlRjwJRg.js +1 -0
  75. package/dist/web/assets/Record-v2KLI-_Z.js +1 -0
  76. package/dist/web/assets/Regression-B-jSt4Jz.js +5 -0
  77. package/dist/web/assets/RelationGraph-8J98lOVG.js +1 -0
  78. package/dist/web/assets/Reports-GI4u6SyW.js +2 -0
  79. package/dist/web/assets/Response-mhBThq2b.js +9 -0
  80. package/dist/web/assets/Responsive-DXu7Ra7K.js +3 -0
  81. package/dist/web/assets/RunDiff-D0SHDNp0.js +1 -0
  82. package/dist/web/assets/Runs-C1Gjdi9M.js +2 -0
  83. package/dist/web/assets/Settings-BGGeuvyF.js +21 -0
  84. package/dist/web/assets/Steps-D-YG0eJy.js +2 -0
  85. package/dist/web/assets/TestCases-DC4w77eQ.js +1 -0
  86. package/dist/web/assets/TestData-CvKWRVVV.js +2 -0
  87. package/dist/web/assets/TestDebt-D8YzN29_.js +1 -0
  88. package/dist/web/assets/TestManagement-C5cDCqrD.js +1 -0
  89. package/dist/web/assets/Tosca-BGUv3RiJ.js +3 -0
  90. package/dist/web/assets/WhatsNew-B_Gyuv8O.js +1 -0
  91. package/dist/web/assets/agents-C0Jg2pN8.js +1 -0
  92. package/dist/web/assets/coverage-BMP6ELFJ.js +5 -0
  93. package/dist/web/assets/dataParts-DbeCj9ga.js +3 -0
  94. package/dist/web/assets/diff-BStuTmsN.js +2 -0
  95. package/dist/web/assets/families-BBFFrUlo.js +1 -0
  96. package/dist/web/assets/filters-CnAMr286.js +1 -0
  97. package/dist/web/assets/fold-D_O_VZui.js +1 -0
  98. package/dist/web/assets/head-CRo48rPt.js +1 -0
  99. package/dist/web/assets/highlight-BcFZIf59.js +4 -0
  100. package/dist/web/assets/index-B3JsM7tv.js +64 -0
  101. package/dist/web/assets/index-CafApcbZ.css +2 -0
  102. package/dist/web/assets/input-CtzK50ZF.js +1 -0
  103. package/dist/web/assets/jsx-runtime-LKYXHABd.js +1 -0
  104. package/dist/web/assets/line-icons-rdF8DYDJ.js +1 -0
  105. package/dist/web/assets/logos-D4oVWzqa.js +1 -0
  106. package/dist/web/assets/palette-DAaGSao7.js +1 -0
  107. package/dist/web/assets/paletteCommands-Co-RlQ8q.js +1 -0
  108. package/dist/web/assets/parts-D357Wolo.js +1 -0
  109. package/dist/web/assets/productParts-B8oHRCJF.js +1 -0
  110. package/dist/web/assets/qualityParts-BLkmIfDY.js +1 -0
  111. package/dist/web/assets/recordTest-Cez2sDJO.js +1 -0
  112. package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  113. package/dist/web/assets/route-BloYJWgw.js +1 -0
  114. package/dist/web/index.html +12 -6
  115. package/docs/ARCHITECTURE.md +1 -1
  116. package/docs/BASAL.md +1 -1
  117. package/docs/DESKTOP.md +20 -1
  118. package/docs/EVIDENCE.md +1 -1
  119. package/docs/MOBILE.md +4 -4
  120. package/docs/PRODUCT_KNOWLEDGE.md +2 -0
  121. package/docs/WEB_APP.md +114 -51
  122. package/docs/user-guide.html +404 -81
  123. package/forgeqe.example.yaml +3 -3
  124. package/package.json +1 -1
  125. package/prompts/page-differs.md +1 -1
  126. package/prompts/requests-rule.md +1 -1
  127. package/prompts/test-reviewer.md +1 -1
  128. package/prompts/test-rules.md +3 -4
  129. package/skills/web-guidance/LICENSE +202 -0
  130. package/skills/web-guidance/SKILL.md +76 -0
  131. package/skills/web-guidance/UPSTREAM +67 -0
  132. package/skills/web-guidance/references/accessibility/accessibility.md +585 -0
  133. package/skills/web-guidance/references/accessibility/accessible-error-announcement.md +302 -0
  134. package/skills/web-guidance/references/accessibility/accessible-generated-content.md +41 -0
  135. package/skills/web-guidance/references/accessibility/respect-os-text-scale.md +127 -0
  136. package/skills/web-guidance/references/css/responsive-design.md +16 -0
  137. package/skills/web-guidance/references/forms/autofill-address-form.md +86 -0
  138. package/skills/web-guidance/references/forms/autofill-payment-form.md +142 -0
  139. package/skills/web-guidance/references/forms/autofill-sign-in-form.md +145 -0
  140. package/skills/web-guidance/references/forms/autofill-sign-up-form.md +155 -0
  141. package/skills/web-guidance/references/forms/forms.md +415 -0
  142. package/skills/web-guidance/references/forms/ime-safe-enter-submit.md +115 -0
  143. package/skills/web-guidance/references/forms/required-field-feedback.md +317 -0
  144. package/skills/web-guidance/references/forms/select-menu-interaction.md +310 -0
  145. package/skills/web-guidance/references/forms/slider.md +184 -0
  146. package/skills/web-guidance/references/forms/sms-otp-form.md +208 -0
  147. package/skills/web-guidance/references/forms/switch.md +60 -0
  148. package/skills/web-guidance/references/forms/validate-input-after-interaction.md +406 -0
  149. package/skills/web-guidance/references/performance/break-up-long-tasks.md +64 -0
  150. package/skills/web-guidance/references/performance/identify-heavy-scripts.md +69 -0
  151. package/skills/web-guidance/references/performance/identify-inp-causes.md +105 -0
  152. package/skills/web-guidance/references/performance/interaction-paint-timing.md +200 -0
  153. package/skills/web-guidance/references/performance/optimize-image-priority.md +73 -0
  154. package/skills/web-guidance/references/performance/performance.md +384 -0
  155. package/skills/web-guidance/references/privacy/privacy.md +247 -0
  156. package/skills/web-guidance/references/security/passkey-authentication.md +218 -0
  157. package/skills/web-guidance/references/security/passkey-management.md +310 -0
  158. package/skills/web-guidance/references/security/passkey-reauthentication.md +142 -0
  159. package/skills/web-guidance/references/security/passkey-registration.md +186 -0
  160. package/skills/web-guidance/references/security/passkeys.md +39 -0
  161. package/skills/web-guidance/references/security/sanitize-untrusted-html.md +105 -0
  162. package/skills/web-guidance/references/security/secure-external-subresources.md +202 -0
  163. package/skills/web-guidance/references/security/security.md +390 -0
  164. package/skills/web-guidance/references/security/trusted-types.md +141 -0
  165. package/skills/web-guidance/references/security/validate-origins.md +197 -0
  166. package/skills/web-guidance/references/security/verify-email-ownership.md +235 -0
  167. package/skills/web-guidance/references/ui-atoms/position-aware-tooltips.md +173 -0
  168. package/skills/web-guidance/references/ui-atoms/responsive-table.md +122 -0
  169. package/skills/web-guidance/references/ui-atoms/viewport-aware-dropdowns.md +178 -0
  170. package/skills/web-guidance/references/ui-behaviors/drag-and-drop.md +108 -0
  171. package/skills/web-guidance/references/ui-behaviors/light-dismiss-a-dialog.md +89 -0
  172. package/skills/web-guidance/references/ui-behaviors/motion.md +97 -0
  173. package/skills/web-guidance/references/ui-behaviors/platform-controls-dismiss-dialog.md +40 -0
  174. package/skills/web-guidance/references/ui-behaviors/prevent-page-scroll-under-modal-dialog.md +59 -0
  175. package/skills/web-guidance/references/ui-behaviors/search-hidden-content.md +141 -0
  176. package/skills/web-guidance/references/ui-behaviors/sortable-table.md +140 -0
  177. package/skills/web-guidance/references/ui-components/accordion.md +343 -0
  178. package/skills/web-guidance/references/ui-components/breadcrumbs.md +168 -0
  179. package/skills/web-guidance/references/ui-components/carousel.md +206 -0
  180. package/skills/web-guidance/references/ui-components/checkbox.md +144 -0
  181. package/skills/web-guidance/references/ui-components/dialog.md +218 -0
  182. package/skills/web-guidance/references/ui-components/hovercard.md +391 -0
  183. package/skills/web-guidance/references/ui-components/menu.md +415 -0
  184. package/skills/web-guidance/references/ui-components/navbar.md +281 -0
  185. package/skills/web-guidance/references/ui-components/navigation-drawer.md +429 -0
  186. package/skills/web-guidance/references/ui-components/persistent-toast-notifications.md +185 -0
  187. package/skills/web-guidance/references/ui-components/progress.md +181 -0
  188. package/skills/web-guidance/references/ui-components/spinner.md +179 -0
  189. package/skills/web-guidance/references/ui-components/tabs.md +371 -0
  190. package/skills/web-guidance/references/ui-components/toolbar.md +277 -0
  191. package/skills/web-guidance/references/user-experience/form-factor-adaptation.md +120 -0
  192. package/skills/web-guidance/references/user-experience/natural-interactions.md +155 -0
  193. package/skills/web-guidance/references/visual-design/color.md +43 -0
  194. package/skills/web-guidance/references/visual-design/dark-mode.md +350 -0
  195. package/dist/web/assets/AgentWork-DwAI0_Of.js +0 -2
  196. package/dist/web/assets/ApiTests-C0vFSHmM.js +0 -10
  197. package/dist/web/assets/Browse-5jfdtRc5.js +0 -2
  198. package/dist/web/assets/Chat-B3uhI94O.js +0 -3
  199. package/dist/web/assets/CommandPalette-D2J4nf5y.js +0 -1
  200. package/dist/web/assets/Compare-CN75w1p9.js +0 -1
  201. package/dist/web/assets/Cost-QoxyjR95.js +0 -1
  202. package/dist/web/assets/Data-BAvkcBVt.js +0 -6
  203. package/dist/web/assets/Desktop-BXdOIalN.js +0 -1
  204. package/dist/web/assets/DesktopReview-Bl2SrPP0.js +0 -1
  205. package/dist/web/assets/Evidence-BJ_I52CD.js +0 -1
  206. package/dist/web/assets/Explore-D9AuyTip.js +0 -2
  207. package/dist/web/assets/Features-CusGMDR9.js +0 -1
  208. package/dist/web/assets/Flags-CycGFuUP.js +0 -2
  209. package/dist/web/assets/Flaky-BcSzJogN.js +0 -1
  210. package/dist/web/assets/Impact-CJHnyZ21.js +0 -3
  211. package/dist/web/assets/Jobs-4xcFzEFo.js +0 -5
  212. package/dist/web/assets/KindPage-BielEIej.js +0 -6
  213. package/dist/web/assets/Migration-NwanKpJg.js +0 -2
  214. package/dist/web/assets/PageAgent-CNw4NXva.js +0 -1
  215. package/dist/web/assets/Product-DS3LJZ4P.js +0 -7
  216. package/dist/web/assets/Production-D3zsyNIS.js +0 -1
  217. package/dist/web/assets/Quality-Ctj2YpC4.js +0 -1
  218. package/dist/web/assets/Readiness-DGcRr_co.js +0 -1
  219. package/dist/web/assets/Record-Cc-wGe_Y.js +0 -1
  220. package/dist/web/assets/Regression-DcsbrRa1.js +0 -5
  221. package/dist/web/assets/Reports-BkCn0-Sf.js +0 -2
  222. package/dist/web/assets/Response-BP0UwQcW.js +0 -9
  223. package/dist/web/assets/Responsive-C8U7dumd.js +0 -3
  224. package/dist/web/assets/RunDiff-BhABuhF_.js +0 -1
  225. package/dist/web/assets/Runs-OwdWEYBv.js +0 -2
  226. package/dist/web/assets/Steps-BvzbQyoD.js +0 -2
  227. package/dist/web/assets/TestCases-CLq_6JA5.js +0 -1
  228. package/dist/web/assets/TestData-B0oKAhp6.js +0 -2
  229. package/dist/web/assets/TestDebt-8NLQ5YV_.js +0 -1
  230. package/dist/web/assets/TestManagement-2LYQ7vsN.js +0 -1
  231. package/dist/web/assets/Tosca-DfvMpPTG.js +0 -3
  232. package/dist/web/assets/WhatsNew-BGFNGwqN.js +0 -1
  233. package/dist/web/assets/families-DYlN5v0i.js +0 -1
  234. package/dist/web/assets/filters-faaSnoIq.js +0 -1
  235. package/dist/web/assets/fold-CUjwWAK3.js +0 -1
  236. package/dist/web/assets/frame-BLPdAXUq.js +0 -13
  237. package/dist/web/assets/head-CsTxBsO0.js +0 -1
  238. package/dist/web/assets/index-CxiCvGZq.js +0 -78
  239. package/dist/web/assets/index-dOIsrzhD.css +0 -2
  240. package/dist/web/assets/line-icons-CwZWt93L.js +0 -1
  241. package/dist/web/assets/logos-dGuc1jIM.js +0 -1
  242. package/dist/web/assets/markdown-BI3F-SJ1.js +0 -10
  243. package/dist/web/assets/paletteCommands-QJiCuUEr.js +0 -1
  244. package/dist/web/assets/parts-CdF1f7yS.js +0 -1
  245. package/dist/web/assets/productParts-hNLD9fN0.js +0 -1
  246. package/dist/web/assets/qualityParts-CT25lBWU.js +0 -1
  247. package/dist/web/assets/recordTest-P792aBUt.js +0 -1
@@ -0,0 +1,429 @@
1
+ # Navigation Drawer
2
+
3
+ ## Overview
4
+
5
+ A navigation drawer is a panel that slides in from the edge of the viewport over the page content, dimming everything behind it. It is opened from a trigger button and dismissed by swiping the panel off-screen, tapping the dimmed backdrop, activating an explicit Close button inside the panel, or pressing Escape.
6
+
7
+ This guide implements the drawer as:
8
+
9
+ - A top-layer element (a modal `<dialog>` or a `popover="manual"` element, see [Choose the drawer element](#choose-the-drawer-element)), so the panel and its `::backdrop` overlay every other element on the page, regardless of stacking context.
10
+ - A horizontally scrolling container with two CSS scroll-snap stops — one for "open", one for "closed" — so the swipe gesture is handled natively by the browser. This delivers momentum, velocity, and interruption tracking for free, with no JavaScript pointer-event code.
11
+ - A scroll-driven animation that ties the backdrop's opacity to the scroll position, so the dim fades in and out smoothly as the user drags the panel.
12
+ - An `IntersectionObserver` on the panel that detects when it has fully entered or fully left the viewport, and uses those moments to close the drawer and update its state.
13
+
14
+ This approach is preferred over JavaScript-driven `transform` animations because the scroll mechanism gives the user direct control of the panel's position (their finger drives it, not a tween) and it much more closely matches the interaction patterns that users are accustomed to in native mobile apps.
15
+
16
+ ### Choose the drawer element
17
+
18
+ First, decide whether the drawer is only ever a drawer, or whether the same element also becomes a regular, always-visible sidebar under certain conditions (e.g. on wide screens). If the request does not say, assume it is only ever a drawer.
19
+
20
+ - **Only ever a drawer**: use a `<dialog>` element opened with `showModal()`. The browser makes the rest of the page inert, exposes the drawer as a modal dialog to assistive technologies, handles Escape, and restores focus on close. See [Implementation with `<dialog>`](#implementation-with-dialog).
21
+ - **Also a sidebar**: use a regular element with `role="dialog"` and `popover="manual"`, and remove the `role` while it acts as a sidebar. A `<dialog>` element does not work here, since it is always exposed as a dialog, but a sidebar is not one. Because a popover is not modal, the code must handle modality manually. See [Implementation for a drawer that also acts as a sidebar](#implementation-for-a-drawer-that-also-acts-as-a-sidebar).
22
+
23
+ ## Implementation with `<dialog>`
24
+
25
+ ### 1. Markup
26
+
27
+ The drawer is a single `<dialog>` containing a horizontal scroller, which contains the visible "sheet". The trigger button lives in the page content. The drawer's close button has an `autofocus` attribute so that this control receives focus when the drawer is opened.
28
+
29
+ ```html
30
+ <!-- MANDATORY: Provide an accessible name for the dialog with aria-label or,
31
+ if there is already text within the drawer that can act as its accessible name,
32
+ with aria-labelledby. -->
33
+ <dialog class="Drawer" id="drawer" aria-label="Navigation drawer">
34
+ <div class="Drawer-scroller">
35
+ <nav class="Drawer-sheet">
36
+ <!-- Close button that can be used to dismiss the drawer -->
37
+ <button id="drawer-close" aria-label="Close menu" autofocus>
38
+ <!-- close icon or blank if icon inserted via CSS -->
39
+ </button>
40
+ <ul>
41
+ <li><a href="/page-1">Page 1</a></li>
42
+ <li><a href="/page-2">Page 2</a></li>
43
+ <!-- ... -->
44
+ </ul>
45
+ </nav>
46
+ </div>
47
+ </dialog>
48
+
49
+ <main>
50
+ <header>
51
+ <!-- aria-controls links the trigger to the drawer; aria-expanded
52
+ reflects the current state for assistive tech. -->
53
+ <button id="drawer-open"
54
+ aria-label="Menu"
55
+ aria-expanded="false"
56
+ aria-controls="drawer">
57
+ <!-- open icon or blank if icon inserted via CSS -->
58
+ </button>
59
+ </header>
60
+ <!-- Page content. -->
61
+ </main>
62
+ ```
63
+
64
+ See `icons` for maintaining accessibility when using icons.
65
+
66
+ ### 2. Styles
67
+
68
+ #### Reset the dialog and fill the viewport
69
+
70
+ The dialog must cover the whole viewport so that the swipe surface extends edge-to-edge. The default user-agent dialog styles (centered, size-capped, padded, bordered) get in the way and must be reset.
71
+
72
+ ```css
73
+ .Drawer {
74
+ /* min() caps the sheet width on large screens but on a phone leaves
75
+ a 20% peek of page content visible, which is the affordance that
76
+ tells the user they can tap outside to dismiss. */
77
+ --drawer-width: min(20em, 80dvw, 100dvw - 24px);
78
+
79
+ /* Custom property driven by the scroll-driven animation below.
80
+ 0 = drawer fully closed (transparent backdrop).
81
+ 1 = drawer fully open (visible backdrop). */
82
+ --drawer-backdrop: 0;
83
+
84
+ /* Reset UA dialog styles that would constrain the element. */
85
+ inset: 0;
86
+ width: auto;
87
+ height: auto;
88
+ max-width: none;
89
+ max-height: none;
90
+ margin: 0;
91
+ padding: 0;
92
+ background: transparent;
93
+ border: 0;
94
+ overflow: visible;
95
+ }
96
+
97
+ /* Style the dialog's ::backdrop to achieve the overlay effect and
98
+ provide visual affordances indicating that the rest of the page is inert */
99
+ .Drawer::backdrop {
100
+ background: #000;
101
+ /* Use calc() to limit the opacity range so the content beneath is visible */
102
+ opacity: calc(var(--drawer-backdrop) / 2);
103
+ }
104
+ ```
105
+
106
+ #### Build the swipe surface with scroll snap
107
+
108
+ The scroller is a horizontal grid wider than the viewport: column 1 holds the sheet (width `--drawer-width`), column 2 is an empty pseudo-element spacer the width of the viewport. Snapping between the two columns is what opens and closes the drawer.
109
+
110
+ ```css
111
+ .Drawer-scroller {
112
+ position: relative;
113
+ display: grid;
114
+ /* Sheet on the left, full-viewport spacer on the right. The user
115
+ scrolls between the two snap stops to open and close. */
116
+ grid-template-columns: var(--drawer-width) 100%;
117
+
118
+ overflow-x: scroll;
119
+ /* Stop the swipe from chaining into the page's vertical scroll
120
+ when the user reaches either snap edge. */
121
+ overscroll-behavior: none;
122
+ scrollbar-width: none;
123
+ /* `mandatory` guarantees the drawer always settles fully open or
124
+ fully closed — never half-open after a partial swipe. */
125
+ scroll-snap-type: x mandatory;
126
+ }
127
+
128
+ /* Enable smooth scrolling natively, but only if the user has not
129
+ requested reduced motion. */
130
+ @media (prefers-reduced-motion: no-preference) {
131
+ .Drawer-scroller {
132
+ scroll-behavior: smooth;
133
+ }
134
+ }
135
+
136
+ /* The empty spacer that creates the "closed" snap stop. */
137
+ .Drawer-scroller::after {
138
+ content: '';
139
+ scroll-snap-align: end;
140
+ /* Open the drawer already scrolled to this stop (drawer off-screen),
141
+ so the JS only needs to scroll to the open position to
142
+ animate it in. */
143
+ scroll-initial-target: nearest;
144
+ }
145
+
146
+ .Drawer-sheet {
147
+ display: grid;
148
+ grid-template-rows: auto 1fr;
149
+ /* Use `svh` (small viewport height) — not `vh` or `dvh` — so the
150
+ sheet height does not jump when the iOS Safari address bar
151
+ resizes mid-swipe. */
152
+ height: 100svh;
153
+
154
+ background: #333;
155
+ color: #fff;
156
+ overflow-y: auto;
157
+ scroll-snap-align: start;
158
+ scrollbar-width: none;
159
+ }
160
+ ```
161
+
162
+ #### Tie the backdrop opacity to the scroll position
163
+
164
+ A scroll-driven animation maps `--drawer-backdrop` from 1 (open) to 0 (closed) across the scroller's range, so the backdrop fades in and out perfectly synced with the drag.
165
+
166
+ ```css
167
+ /* MANDATORY: Wrap this entire block in @supports. Browsers that don't
168
+ support animation-timeline still parse the @keyframes and would
169
+ apply the animation's `0%` value (--drawer-backdrop: 1) at all
170
+ times, leaving the backdrop permanently opaque. The @supports gate
171
+ ensures the animation is only registered where it actually works. */
172
+ @supports (animation-timeline: scroll()) {
173
+ .Drawer {
174
+ /* timeline-scope lets .Drawer reference a scroll-timeline that
175
+ is defined on its descendant (the scroller). Without this, the
176
+ timeline name is not visible to the .Drawer element. */
177
+ timeline-scope: --drawer-fade;
178
+ animation: fade-drawer-backdrop linear both;
179
+ animation-timeline: --drawer-fade;
180
+ }
181
+
182
+ .Drawer-scroller {
183
+ /* The horizontal scroll position of this element drives the
184
+ timeline named `--drawer-fade`. */
185
+ scroll-timeline: --drawer-fade x;
186
+ }
187
+
188
+ /* @property is REQUIRED. Without registering --drawer-backdrop with
189
+ a `<number>` syntax, the browser treats it as a string and cannot
190
+ interpolate it — the backdrop would jump from 0 to 1 with no
191
+ fade. */
192
+ @property --drawer-backdrop {
193
+ syntax: '<number>';
194
+ inherits: true;
195
+ initial-value: 0;
196
+ }
197
+
198
+ @keyframes fade-drawer-backdrop {
199
+ /* Scroll position 0 = drawer fully open = backdrop visible. */
200
+ 0% { --drawer-backdrop: 1 }
201
+ /* Scroll position 100% = drawer fully closed = backdrop hidden. */
202
+ 100% { --drawer-backdrop: 0 }
203
+ }
204
+ }
205
+ ```
206
+
207
+ ### 3. Open and close the drawer
208
+
209
+ Opening is two steps: show the dialog as modal, then scroll the sheet into view. Closing is one step: scroll back to the spacer; an observer (step 4) closes the dialog once the sheet is fully off-screen.
210
+
211
+ ```js
212
+ const drawer = document.getElementById('drawer');
213
+ const openBtn = document.getElementById('drawer-open');
214
+ const scroller = drawer.querySelector('.Drawer-scroller');
215
+ const sheet = drawer.querySelector('.Drawer-sheet');
216
+ const closeBtn = document.getElementById('drawer-close');
217
+
218
+ function openDrawer() {
219
+ // Show the dialog first so the element is in the top layer before
220
+ // we trigger any scrolling. `scroll-initial-target` (set on the
221
+ // ::after spacer) places the initial scroll position at the closed
222
+ // stop, so the drawer enters the top layer already off-screen.
223
+ drawer.showModal();
224
+
225
+ // Scroll the sheet into view. The `behavior: 'auto'` option defers
226
+ // to the CSS `scroll-behavior` property, which will be smooth unless
227
+ // the user prefers reduced motion. Snap takes over at the end and
228
+ // locks the drawer fully open.
229
+ scroller.scrollTo({left: 0, behavior: 'auto'});
230
+ }
231
+
232
+ function closeDrawer() {
233
+ // Scroll back to the spacer. Do NOT call close() here —
234
+ // doing so would remove the element from the top layer mid-animation
235
+ // and the close animation would not be visible. The
236
+ // IntersectionObserver in step 4 closes the dialog once the sheet
237
+ // has actually left the viewport.
238
+ scroller.scrollTo({left: scroller.offsetWidth, behavior: 'auto'});
239
+ }
240
+ ```
241
+
242
+ ### 4. Detect open and closed state
243
+
244
+ Use an `IntersectionObserver` on the sheet — not the scroll position — as the source of truth for the drawer's state. The observer fires regardless of how the sheet moved (user swipe, programmatic scroll, snap settle), so all dismissal paths converge in the same callback.
245
+
246
+ Because the drawer is a modal `<dialog>`, the browser makes the rest of the page inert while it is open and moves focus back to the trigger button when it closes, so these callbacks only need to close the dialog and keep `aria-expanded` in sync.
247
+
248
+ ```js
249
+ function onDrawerOpened() {
250
+ openBtn.setAttribute('aria-expanded', 'true');
251
+ }
252
+
253
+ function onDrawerClosed() {
254
+ // Close the dialog only after the close animation completes,
255
+ // so the slide-out is visible to the user.
256
+ drawer.close();
257
+ openBtn.setAttribute('aria-expanded', 'false');
258
+ }
259
+
260
+ // Treat "any pixel of the sheet visible inside the dialog" as
261
+ // "open enough to count as not closed". This threshold is intentionally
262
+ // tiny so the closed callback only fires once the sheet is truly gone.
263
+ const visibleThreshold = 1 / window.innerWidth;
264
+
265
+ const observer = new IntersectionObserver(
266
+ (entries) => {
267
+ // During programmatic scrolling the observer can deliver multiple
268
+ // entries in one batch. Only the most recent describes the
269
+ // current state; earlier entries are intermediate positions.
270
+ const entry = entries.at(-1);
271
+ if (entry.intersectionRatio < visibleThreshold) onDrawerClosed();
272
+ if (entry.intersectionRatio === 1) onDrawerOpened();
273
+ },
274
+ // root: drawer makes the dialog element the intersection root,
275
+ // so the ratio reflects the sheet's visibility within the dialog
276
+ // (i.e. how much of it has been swiped on-screen).
277
+ {root: drawer, threshold: [visibleThreshold, 1]},
278
+ );
279
+ observer.observe(sheet);
280
+ ```
281
+
282
+ ### 5. Wire up the trigger and dismissal handlers
283
+
284
+ ```js
285
+ // Open trigger.
286
+ openBtn.addEventListener('click', openDrawer);
287
+
288
+ // Close trigger.
289
+ closeBtn.addEventListener('click', closeDrawer);
290
+
291
+ // Light-dismiss: a tap on the dimmed area (anywhere inside the
292
+ // dialog but outside the sheet) closes the drawer. Do not use
293
+ // closedby="any": the dialog fills the viewport, so taps land on the
294
+ // dialog rather than its ::backdrop, and it would close without the
295
+ // slide-out animation.
296
+ drawer.addEventListener('click', (event) => {
297
+ if (!sheet.contains(event.target)) closeDrawer();
298
+ });
299
+
300
+ // Escape key. A modal dialog fires `cancel` on Escape; prevent the
301
+ // instant close and slide the drawer out instead.
302
+ // NOTE: Browsers may make `cancel` non-cancelable on repeated Escape
303
+ // presses without user activation in between, closing the dialog instantly.
304
+ drawer.addEventListener('cancel', (event) => {
305
+ if (event.cancelable) {
306
+ event.preventDefault();
307
+ closeDrawer();
308
+ }
309
+ });
310
+ ```
311
+
312
+ ## Implementation for a drawer that also acts as a sidebar
313
+
314
+ Use this implementation when the same element also becomes a regular, always-visible sidebar under certain conditions (see [Choose the drawer element](#choose-the-drawer-element)). Toggle `role` from the same media query that switches the layout (e.g. with `matchMedia()`): remove it while the element acts as a sidebar, and restore `role="dialog"` when it becomes a drawer again. This guide does not cover the sidebar layout itself.
315
+
316
+ Follow the [`<dialog>` implementation](#implementation-with-dialog), with these changes:
317
+
318
+ - **Markup**: `<div class="Drawer" id="drawer" popover="manual" role="dialog" aria-label="Navigation drawer">`. `popover="manual"` is REQUIRED; do not use `popover="auto"` or `"hint"`, as their built-in light-dismiss would also fire mid-swipe.
319
+ - **Open and close**: call `showPopover()` instead of `showModal()` and `hidePopover()` instead of `close()`. The rest of the CSS and JS is unchanged.
320
+ - **Modality**: a popover is not modal, so the code must do what a modal dialog does natively:
321
+ - Mark the rest of the page `inert` while the drawer is open.
322
+ - Apply `aria-modal="true"` while the drawer is open, and remove it when it closes.
323
+ - Move focus back to the trigger button after the drawer closes.
324
+ - Handle Escape with a `keydown` listener on `document`, since popovers do not fire `cancel`.
325
+
326
+ ```js
327
+ const main = document.querySelector('main');
328
+
329
+ function openDrawer() {
330
+ drawer.showPopover();
331
+ // Mark everything outside the drawer inert immediately on open (include
332
+ // sibling <header>/<footer> landmarks if they live outside <main>).
333
+ main.inert = true;
334
+ drawer.setAttribute('aria-modal', 'true');
335
+ scroller.scrollTo({left: 0, behavior: 'auto'});
336
+ }
337
+
338
+ function onDrawerClosed() {
339
+ // The observer also reports "closed" on page load; ignore it unless open.
340
+ if (!drawer.hasAttribute('aria-modal')) return;
341
+ drawer.hidePopover();
342
+ main.inert = false;
343
+ drawer.removeAttribute('aria-modal');
344
+ openBtn.setAttribute('aria-expanded', 'false');
345
+ openBtn.focus();
346
+ }
347
+
348
+ // Escape key. Listen on document because focus may be inside the
349
+ // drawer when the user presses Escape.
350
+ document.addEventListener('keydown', (event) => {
351
+ if (event.key === 'Escape') closeDrawer();
352
+ });
353
+ ```
354
+
355
+ ## Fallback strategies
356
+
357
+ Baseline status for Scroll snap: Widely available. It's been Baseline since 2020-01-15.
358
+ Supported by: Chrome 69 (Sep 2018), Edge 79 (Jan 2020), Firefox 68 (Jul 2019), and Safari 11 (Sep 2017).
359
+
360
+ Baseline status for Intersection observer: Widely available. It's been Baseline since 2019-03-25.
361
+ Supported by: Chrome 58 (Apr 2017), Edge 16 (Oct 2017), Firefox 55 (Aug 2017), Safari 12.1 (Mar 2019), and Safari iOS 12.2 (Mar 2019).
362
+
363
+ The scroll-driven animation that fades the backdrop and `scroll-initial-target` are progressive enhancements with simple fallbacks that can be easily implemented if wide browser support is required.
364
+
365
+ ### Backdrop fade fallback (no `animation-timeline` support):
366
+
367
+ Baseline status for Scroll-driven animations: Newly available. It's been Baseline since 2026-10-27.
368
+ Supported by: Chrome 115 (Jul 2023), Edge 115 (Jul 2023), Firefox 159 (Oct 2026), and Safari 26 (Sep 2025).
369
+
370
+ Detect with `CSS.supports('animation-timeline: scroll()')` and write `--drawer-backdrop` from a `scroll` event listener if not supported. The CSS `@supports` block in step 2 ensures the keyframes never apply in unsupported browsers, so the JavaScript value is the only writer.
371
+
372
+ ```js
373
+ if (!CSS.supports('animation-timeline: scroll()')) {
374
+ scroller.addEventListener('scroll', () => {
375
+ // Same mapping as the @keyframes: 0 scroll = 1 (open),
376
+ // sheet-width scroll = 0 (closed).
377
+ const ratio = 1 - scroller.scrollLeft / sheet.offsetWidth;
378
+ drawer.style.setProperty('--drawer-backdrop', ratio);
379
+ });
380
+ }
381
+ ```
382
+
383
+ ### Initial scroll position fallback (no `scroll-initial-target` support):
384
+
385
+ Browser support for scroll-initial-target: Limited availability.
386
+ Supported by: Chrome 133 (Feb 2025) and Edge 133 (Feb 2025).
387
+ Unsupported in: Firefox and Safari.
388
+
389
+ Detect with `CSS.supports('scroll-initial-target', 'nearest')` and inside `openDrawer()`, jump-scroll the scroller to the closed position immediately after showing the drawer (`showModal()`, or `showPopover()` when it [also acts as a sidebar](#implementation-for-a-drawer-that-also-acts-as-a-sidebar)). Without this, the drawer would appear instantly in the open position with no slide-in animation.
390
+
391
+ ```js
392
+ async function openDrawer() {
393
+ drawer.showModal(); // sidebar variant: showPopover(), main.inert = true, and aria-modal="true"
394
+
395
+ if (!CSS.supports('scroll-initial-target', 'nearest')) {
396
+ // Jump-scroll to the closed stop so the scroll below
397
+ // animates the drawer in from off-screen.
398
+ scroller.scrollTo({left: scroller.offsetWidth, behavior: 'instant'});
399
+ // Wait two animation frames for the jump-scroll to commit.
400
+ // A single rAF is not enough — the second `scrollTo` would
401
+ // cancel the first before the browser has a chance to apply it.
402
+ await new Promise((r) =>
403
+ requestAnimationFrame(() => requestAnimationFrame(r))
404
+ );
405
+ }
406
+
407
+ scroller.scrollTo({left: 0, behavior: 'auto'});
408
+ }
409
+ ```
410
+
411
+ ### `@property` fallback (no registered custom properties):
412
+
413
+ Baseline status for Registered custom properties: Newly available. It's been Baseline since 2024-07-09.
414
+ Supported by: Chrome 85 (Aug 2020), Edge 85 (Aug 2020), Firefox 128 (Jul 2024), and Safari 16.4 (Mar 2023).
415
+
416
+ `@property` is only needed because the scroll-driven animation interpolates `--drawer-backdrop` between keyframes — without registration, the property would be treated as a string and would jump between 0 and 1 with no fade. If the scroll-driven animation fallback above is in place, that JavaScript writes a fresh numeric string to `--drawer-backdrop` on every scroll frame and never interpolates, so no separate `@property` fallback is needed since all browsers that support scroll-driven animations also support `@property`.
417
+
418
+
419
+ ### Popover API fallback (sidebar variant only):
420
+
421
+ Baseline status for the api.HTMLElement.showPopover capability: Widely available. It's been Baseline since 2024-04-16.
422
+ Supported by: Chrome 114 (May 2023), Edge 114 (Jun 2023), Firefox 125 (Apr 2024), and Safari 17 (Sep 2023).
423
+
424
+ Baseline status for inert: Widely available. It's been Baseline since 2023-04-11.
425
+ Supported by: Chrome 102 (May 2022), Edge 102 (May 2022), Firefox 112 (Apr 2023), and Safari 15.5 (May 2022).
426
+
427
+ When the drawer [also acts as a sidebar](#implementation-for-a-drawer-that-also-acts-as-a-sidebar), it uses `popover="manual"` and implements dismissal entirely from JavaScript, so it does not depend on light-dismiss, the `popovertarget` attribute, or top-layer-managed Escape handling. Aside from top-layer promotion (`showPopover()`) and `::backdrop`, the only popover behavior it relies on is processing `autofocus` when shown.
428
+
429
+ If wider browser support is needed, do not branch on feature detection — simply do not use popover at all. Drop the `popover="manual"` attribute, replace top-layer promotion with `position: fixed` and a high `z-index`, replace `::backdrop` with a sibling element styled identically (using the same `--drawer-backdrop` custom property), toggle visibility from a class instead of `showPopover()`/`hidePopover()`, and call `closeBtn.focus({preventScroll: true})` in `openDrawer()` after making the drawer visible (`preventScroll` avoids scrolling the container early). The rest of the component (scroll snap, the scroll-driven backdrop animation, the `IntersectionObserver`, and the dismissal handlers) is unchanged.
@@ -0,0 +1,185 @@
1
+ # Creating Toast Notifications
2
+
3
+ Toast notifications are transient status messages. Unlike menus, they should not close when a user interacts with other parts of the page. The popover="manual" state is ideal because it lacks "light-dismiss" behavior and allows multiple notifications to coexist.
4
+
5
+ ## When to use
6
+
7
+ Toast notifications must be used to provide non-critical, supplemental information about the results of an interaction, or an event (e.g. an email has been received). An example may include confirming that a form submission was successful. Notifications that require immediate attention should instead use an alternative component. Examples include inline banners, dialogs or modal dialogs. These examples surface information in a way that is easier to identify for everyone. Toasts should be used sparingly, as making them accessible to everyone means addressing complex considerations, and is the reason why some companies have opted to no longer use them, and instead, utilize the alternative aforementioned components.
8
+
9
+ ## Implementation guidelines
10
+
11
+ Prefer persistent toast notifications that remain present until they are dismissed, except for frequent, low importance events, where the friction persistence creates outweighs the value of the information provided. In those cases, do evaluate whether toasts actually add to the user experience in general — in some cases it may be preferable to not have them at all. If using a pattern that does dismiss toasts after a short period of time, check whether focus is on a control in the toast before dismissal. If the user is focused on a control inside the toast, pause dismissal until focus has left the toast.
12
+
13
+ * **MANDATORY:** Use popover="manual" so the notification stays visible until explicitly closed or timed out by a script.
14
+ * **MANDATORY:** Ensure that the information in the toast can be identified by other means, so that if it is part of a pattern that disappears after a short period of time, people can still identify the information without the toast being present.
15
+ * **DO** use a container to manage the stacking of multiple toasts. Since popovers in the Top Layer ignore parent z-index, you must position them individually or within a common layout group.
16
+ * **DO** add toast notifications consistently to the same container in the page, so that people using assistive technologies can consistently locate them.
17
+ * **DO** make the container a region, with an accessible name, so that it can be easily identified using a screen reader. For example: `<div role="region" aria-label="Notifications"></div>`.
18
+ * **DO** use `ariaNotify()` to announce the content present in toasts that are displayed. This ensures that people using screen readers, who cannot see the screen, are aware of the presence of toast messages
19
+ * **DO** ensure that only the toast's visible text is announced as part of the `ariaNotify()` and not the names of any controls. If actions are available in the toast (aside from a close control), append "Actions available" to the end of the announcement.
20
+ * **DO** provide an explicit "Close" button within the toast using popovertargetaction="hide".
21
+ * **DO** ensure that a toast's dismiss button is keyboard-focusable (without automatically stealing focus when the toast appears), so keyboard users can navigate to the toast region and dismiss notifications.
22
+ * **DO** manage focus when a user manually dismisses a currently focused toast: move focus to the next remaining toast in the stack, or—if no toasts remain—return focus to the user's prior focus location (or the control that triggered the toast).
23
+ * **DO** declare `transition-behavior: allow-discrete` as a separate property after `transition` (rather than inside the `transition` shorthand) to animate entry and exit from the Top Layer without older browsers ignoring the `transition` declaration.
24
+ * **DO** provide a non-animated version using the `prefers-reduced-motion` media query
25
+ * **DO** ensure that toast messages scale in size, and that all toast content remains visible when resizing text up to 200% to adhere to WCAG 1.4.4 Resize Text (Level AA)
26
+ * **DO** ensure that all toast content remains visible when adjusting text styling and spacing with CSS to adhere to 1.4.12 Text Spacing (Level AA)
27
+ * **DO** ensure that all toast content remains visible, or can be accessed still, when using a viewport sized to 320 by 256 CSS pixels to adhere to 1.4.10 Reflow (Level AA)
28
+
29
+ * **DON'T** surface toasts in scenarios where focus redirection may be used at the same time. The focus redirection may cancel out the toast announcements, resulting in people missing information.
30
+ * **DON'T** use toasts in modal dialogs. Content outside of the dialog will be inert and unavailable to assistive technologies. Placing the toast in a modal dialog, separate from the existing toast container makes it difficult to locate, and may lead to people not being able to locate it.
31
+ * **DON'T** surface toast notifications in the background while a modal dialog is open. It's likely the notification will be missed. Instead, suppress the notification until the modal dialog is dismissed.
32
+ * **DON'T** include controls in toast notifications that perform actions not already permanently available outside the toast notifications. Controls in toasts should be used sparingly, and only provided as a shortcut for actions already available via the UI.
33
+
34
+ ## Optional: Usability & accessibility improvements
35
+
36
+ * **Surface previous toasts**: Provide a way for people to access a list of past toast messages. This can help people who may encounter difficulty in remembering what the toast informed them, or reduce anxiety for people who inadvertently dismissed a toast message.
37
+ * **Customize toast notifications**: Provide a way for people to customize which toast notifications are provided. This can help to ensure that information provided to people is relevant, reducing distractions and confusion.
38
+ * **Use an alternative way to communicate toasts are present**: It is recommended that there are multiple ways to communicate that a toast has been made visible. An example of this may be a brief sound effect (which could be turned off). This will help people using screen magnification software, who may otherwise find it difficult to identify that toasts are present.
39
+
40
+ ## Fallback strategies
41
+
42
+ ### Fallbacks & browser support for Popover
43
+
44
+ Baseline status for Popover: Newly available. It's been Baseline since 2025-01-27.
45
+ Supported by: Chrome 116 (Aug 2023), Edge 116 (Aug 2023), Firefox 125 (Apr 2024), Safari 17 (Sep 2023), and Safari iOS 18.3 (Jan 2025).
46
+
47
+ The Popover API is mostly **progressive enhancement**, but its defining behaviors — top-layer promotion, light-dismiss, and `popovertarget` invocation — have no CSS-only equivalent. Older browsers need a polyfill, or a manual fallback if you would rather not ship one.
48
+
49
+ **Polyfill:** To support the `popover` attribute in older browsers, conditionally load [`@oddbird/popover-polyfill`](https://github.com/oddbird/popover-polyfill). **MANDATORY:** Feature detect by checking for the `popover` property on `HTMLElement.prototype`, and load the polyfill **only** when native support is missing — do NOT load it unconditionally.
50
+
51
+ With a bundler or import map:
52
+
53
+ ```js
54
+ // MANDATORY: Feature detect 'popover' on HTMLElement.prototype.
55
+ if (!Object.hasOwn(HTMLElement.prototype, "popover")) {
56
+ import("@oddbird/popover-polyfill");
57
+ }
58
+ ```
59
+
60
+ If not using a package manager, import from a CDN, e.g. `"https://unpkg.com/@oddbird/popover-polyfill@latest/dist/popover.min.js"`.
61
+
62
+ Caveats when using the polyfill:
63
+ - Do NOT use the `popover` IDL attribute for any code that may run before the polyfill is fully loaded. It will not be mirrored as an attribute, the popover will not be picked up by the polyfill, and the property will be shadowing the accessor the polyfill adds forever. Use `setAttribute()`/`removeAttribute()` instead.
64
+ - **Styling caveat:** The polyfill cannot define the real `:popover-open` pseudo-class, so it applies a `.\:popover-open` class instead. **MANDATORY:** Combine the two with `:is()` or `:where()`, otherwise browsers that lack `:popover-open` discard the entire rule:
65
+
66
+ ```css
67
+ [popover]:is(:popover-open, .\:popover-open) {
68
+ display: block;
69
+ }
70
+ ```
71
+
72
+ ### Fallbacks & browser support for ariaNotify()
73
+
74
+ Baseline status for ariaNotify(): Newly available. It's been Baseline since 2026-09-14.
75
+ Supported by: Chrome 141 (Sep 2025), Edge 141 (Oct 2025), Firefox 150 (Apr 2026), and Safari 27 (Sep 2026).
76
+
77
+ Baseline status for ariaNotify(): Newly available. It's been Baseline since 2026-09-14.
78
+ Supported by: Chrome 141 (Sep 2025), Edge 141 (Oct 2025), Firefox 150 (Apr 2026), and Safari 27 (Sep 2026).
79
+
80
+ Use an ARIA live region, ensuring that the container is present in the page on load, and then add the messages to the live region container when relevant.
81
+
82
+ ```html
83
+ <!-- Pre-populated hidden live region container -->
84
+ <div id="notification" aria-live="assertive"></div>
85
+ ```
86
+
87
+ This content will be present in the DOM, and can be read by a screen reader after the message has been announced. Therefore, in order to provide context to this region, when the live region has content, add in text immediately before the container to provide context to the announcement. This will help people understand the purpose of the content if they identify it when reading the page.
88
+
89
+ ```html
90
+ <p class="inclusively-hidden">Screen reader announcements</p>
91
+ <!-- Pre-populated hidden live region container -->
92
+ <div id="notification" aria-live="assertive">
93
+ Dynamic announcement injected into the existing container.
94
+ </div>
95
+ ```
96
+
97
+ ### Fallbacks & browser support for Anchor positioning
98
+
99
+ Browser support for Anchor positioning: Limited availability.
100
+ Supported by: Chrome 157 (Nov 2026), Edge 157 (Nov 2026), and Safari 27 (Sep 2026).
101
+ Unsupported in: Firefox.
102
+
103
+ Without CSS Anchor Positioning, tethered elements such as `[popover]` overlays fall back to their default user-agent placement (centered in the viewport for popovers). Depending on whether spatial tethering is required for your use case, either conditionally load the polyfill or gate your positioning rules with `@supports`.
104
+
105
+ #### Option 1: Polyfill (`@oddbird/css-anchor-positioning`)
106
+
107
+ When the positioned element must stay spatially tethered to its trigger in unsupported browsers, conditionally load the `@oddbird/css-anchor-positioning` package.
108
+
109
+ **MANDATORY:** Feature-detect support via `CSS.supports("anchor-name: --a")` (or `"anchorName" in CSSStyleDeclaration.prototype`), and load the polyfill **only** when native support is missing — do NOT load it unconditionally.
110
+
111
+ With a bundler or import map:
112
+
113
+ ```js
114
+ // MANDATORY: Feature-detect anchor positioning support before loading the polyfill.
115
+ if (!CSS.supports("anchor-name: --a")) {
116
+ import("@oddbird/css-anchor-positioning");
117
+ }
118
+ ```
119
+
120
+ Without a bundler, import from a CDN inside a `<script type="module">`:
121
+
122
+ ```html
123
+ <!-- MANDATORY: Conditionally install the anchor positioning polyfill -->
124
+ <script type="module">
125
+ if (!CSS.supports("anchor-name: --a")) {
126
+ import("https://unpkg.com/@oddbird/css-anchor-positioning");
127
+ }
128
+ </script>
129
+ ```
130
+
131
+ **Polyfill caveats:**
132
+ - **No implicit anchors:** The polyfill does not support implicit anchor associations (such as those created by `popovertarget`, `commandfor`, `interestfor`, or `showPopover({ source })`). You **MUST** set a unique explicit `anchor-name` on each trigger and a matching `position-anchor` on the positioned element.
133
+ - **No `position-area` with `position-try-fallbacks`:** `position-area` with `position-try-fallbacks` is not supported by the polyfill. When using the polyfill on elements needing fallbacks, position elements using `anchor()` functions on inset properties (`top`, `left`, `right`, `bottom`) with `inset: auto` instead of `position-area`.
134
+ - **Do not wrap polyfilled rules in `@supports`:** Browsers without native anchor positioning evaluate `@supports (position-area: ...)` and `@supports (anchor-name: --a)` to `false` and discard the block before the polyfill can process it.
135
+
136
+ ```css
137
+ .trigger {
138
+ /* MANDATORY: Each trigger and positioned element pair must share a unique anchor name. */
139
+ anchor-name: --my-trigger;
140
+ }
141
+
142
+ [popover].anchored-overlay {
143
+ position-anchor: --my-trigger;
144
+ /* MANDATORY: Use anchor() on inset properties rather than position-area when using the polyfill on elements needing position-try-fallbacks. */
145
+ inset: auto;
146
+ top: anchor(bottom);
147
+ left: anchor(left);
148
+ margin: 0;
149
+ }
150
+ ```
151
+
152
+ #### Option 2: Progressive enhancement with `@supports` (no polyfill)
153
+
154
+ If you do not ship the polyfill, **DO NOT** set `inset: auto` or `margin: 0` unconditionally on a `[popover]` element that relies on `position-area` or `anchor()`. In browsers without anchor positioning, `inset: auto` overrides the user-agent centering (`inset: 0; margin: auto`) while `position-area` is ignored, leaving the popover stranded at `(0, 0)` or overlapping its trigger.
155
+
156
+ Instead, gate `inset: auto` and `margin: 0` inside `@supports` for the specific positioning feature used (for example, `@supports (position-area: block-end)` or `@supports (top: anchor(bottom))`) so unsupported browsers retain the default centered popover placement, or provide a matching `@supports not (...)` fallback layout (such as a fixed bottom sheet):
157
+
158
+ ```css
159
+ @supports (position-area: block-end) {
160
+ [popover].anchored-overlay {
161
+ inset: auto;
162
+ margin: 0;
163
+ position-area: block-end span-inline-end;
164
+ position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
165
+ }
166
+ }
167
+
168
+ @supports not (position-area: block-end) {
169
+ /* Optional: override default popover centering with a fixed bottom bar */
170
+ [popover].anchored-overlay {
171
+ position: fixed;
172
+ inset: auto 0 0 0;
173
+ width: auto;
174
+ margin: 0;
175
+ }
176
+ }
177
+ ```
178
+
179
+ #### sibling-index()
180
+
181
+ * **Guidance:** If sibling-index() is not supported, use the `+` operator to add margin manually. I.e. `popover + popover { margin-top: 1rem }`
182
+
183
+ #### transition-behavior
184
+
185
+ * **Guidance:** If transition-behavior is not supported, use JavaScript to add animation via classes as the toast element transitions in and out.