@capagents/forgeqe 3.1.0 → 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 (254) hide show
  1. package/HOW_TO_USE.md +465 -95
  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 -6708
  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 +2251 -1886
  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 -12
  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 +463 -87
  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/responsive-review.md +38 -0
  128. package/prompts/responsive-split.md +40 -0
  129. package/prompts/responsive.md +42 -0
  130. package/prompts/test-reviewer.md +1 -1
  131. package/prompts/test-rules.md +3 -4
  132. package/skills/web-guidance/LICENSE +202 -0
  133. package/skills/web-guidance/SKILL.md +76 -0
  134. package/skills/web-guidance/UPSTREAM +67 -0
  135. package/skills/web-guidance/references/accessibility/accessibility.md +585 -0
  136. package/skills/web-guidance/references/accessibility/accessible-error-announcement.md +302 -0
  137. package/skills/web-guidance/references/accessibility/accessible-generated-content.md +41 -0
  138. package/skills/web-guidance/references/accessibility/respect-os-text-scale.md +127 -0
  139. package/skills/web-guidance/references/css/responsive-design.md +16 -0
  140. package/skills/web-guidance/references/forms/autofill-address-form.md +86 -0
  141. package/skills/web-guidance/references/forms/autofill-payment-form.md +142 -0
  142. package/skills/web-guidance/references/forms/autofill-sign-in-form.md +145 -0
  143. package/skills/web-guidance/references/forms/autofill-sign-up-form.md +155 -0
  144. package/skills/web-guidance/references/forms/forms.md +415 -0
  145. package/skills/web-guidance/references/forms/ime-safe-enter-submit.md +115 -0
  146. package/skills/web-guidance/references/forms/required-field-feedback.md +317 -0
  147. package/skills/web-guidance/references/forms/select-menu-interaction.md +310 -0
  148. package/skills/web-guidance/references/forms/slider.md +184 -0
  149. package/skills/web-guidance/references/forms/sms-otp-form.md +208 -0
  150. package/skills/web-guidance/references/forms/switch.md +60 -0
  151. package/skills/web-guidance/references/forms/validate-input-after-interaction.md +406 -0
  152. package/skills/web-guidance/references/performance/break-up-long-tasks.md +64 -0
  153. package/skills/web-guidance/references/performance/identify-heavy-scripts.md +69 -0
  154. package/skills/web-guidance/references/performance/identify-inp-causes.md +105 -0
  155. package/skills/web-guidance/references/performance/interaction-paint-timing.md +200 -0
  156. package/skills/web-guidance/references/performance/optimize-image-priority.md +73 -0
  157. package/skills/web-guidance/references/performance/performance.md +384 -0
  158. package/skills/web-guidance/references/privacy/privacy.md +247 -0
  159. package/skills/web-guidance/references/security/passkey-authentication.md +218 -0
  160. package/skills/web-guidance/references/security/passkey-management.md +310 -0
  161. package/skills/web-guidance/references/security/passkey-reauthentication.md +142 -0
  162. package/skills/web-guidance/references/security/passkey-registration.md +186 -0
  163. package/skills/web-guidance/references/security/passkeys.md +39 -0
  164. package/skills/web-guidance/references/security/sanitize-untrusted-html.md +105 -0
  165. package/skills/web-guidance/references/security/secure-external-subresources.md +202 -0
  166. package/skills/web-guidance/references/security/security.md +390 -0
  167. package/skills/web-guidance/references/security/trusted-types.md +141 -0
  168. package/skills/web-guidance/references/security/validate-origins.md +197 -0
  169. package/skills/web-guidance/references/security/verify-email-ownership.md +235 -0
  170. package/skills/web-guidance/references/ui-atoms/position-aware-tooltips.md +173 -0
  171. package/skills/web-guidance/references/ui-atoms/responsive-table.md +122 -0
  172. package/skills/web-guidance/references/ui-atoms/viewport-aware-dropdowns.md +178 -0
  173. package/skills/web-guidance/references/ui-behaviors/drag-and-drop.md +108 -0
  174. package/skills/web-guidance/references/ui-behaviors/light-dismiss-a-dialog.md +89 -0
  175. package/skills/web-guidance/references/ui-behaviors/motion.md +97 -0
  176. package/skills/web-guidance/references/ui-behaviors/platform-controls-dismiss-dialog.md +40 -0
  177. package/skills/web-guidance/references/ui-behaviors/prevent-page-scroll-under-modal-dialog.md +59 -0
  178. package/skills/web-guidance/references/ui-behaviors/search-hidden-content.md +141 -0
  179. package/skills/web-guidance/references/ui-behaviors/sortable-table.md +140 -0
  180. package/skills/web-guidance/references/ui-components/accordion.md +343 -0
  181. package/skills/web-guidance/references/ui-components/breadcrumbs.md +168 -0
  182. package/skills/web-guidance/references/ui-components/carousel.md +206 -0
  183. package/skills/web-guidance/references/ui-components/checkbox.md +144 -0
  184. package/skills/web-guidance/references/ui-components/dialog.md +218 -0
  185. package/skills/web-guidance/references/ui-components/hovercard.md +391 -0
  186. package/skills/web-guidance/references/ui-components/menu.md +415 -0
  187. package/skills/web-guidance/references/ui-components/navbar.md +281 -0
  188. package/skills/web-guidance/references/ui-components/navigation-drawer.md +429 -0
  189. package/skills/web-guidance/references/ui-components/persistent-toast-notifications.md +185 -0
  190. package/skills/web-guidance/references/ui-components/progress.md +181 -0
  191. package/skills/web-guidance/references/ui-components/spinner.md +179 -0
  192. package/skills/web-guidance/references/ui-components/tabs.md +371 -0
  193. package/skills/web-guidance/references/ui-components/toolbar.md +277 -0
  194. package/skills/web-guidance/references/user-experience/form-factor-adaptation.md +120 -0
  195. package/skills/web-guidance/references/user-experience/natural-interactions.md +155 -0
  196. package/skills/web-guidance/references/visual-design/color.md +43 -0
  197. package/skills/web-guidance/references/visual-design/dark-mode.md +350 -0
  198. package/dist/web/assets/AgentWork-C3KdZh5M.js +0 -2
  199. package/dist/web/assets/ApiTests-BLnl7JGO.js +0 -10
  200. package/dist/web/assets/Browse-C-Enjpmd.js +0 -2
  201. package/dist/web/assets/Chat-Bt6jZI68.js +0 -3
  202. package/dist/web/assets/Choices-D5eTFinz.js +0 -3
  203. package/dist/web/assets/CommandPalette-D89NM2_E.js +0 -1
  204. package/dist/web/assets/Compare-YfFYHwfK.js +0 -1
  205. package/dist/web/assets/Cost-ClaDz0YR.js +0 -1
  206. package/dist/web/assets/Data-jSFgAfej.js +0 -6
  207. package/dist/web/assets/Desktop-BofKeLVf.js +0 -1
  208. package/dist/web/assets/DesktopReview--WjeZh3w.js +0 -1
  209. package/dist/web/assets/Evidence-CJNzSQpY.js +0 -1
  210. package/dist/web/assets/Explore-BdFvqgF4.js +0 -2
  211. package/dist/web/assets/Features-CIBbw6PG.js +0 -1
  212. package/dist/web/assets/Flags-B62v4uWR.js +0 -2
  213. package/dist/web/assets/Flaky-Cut1kZw6.js +0 -1
  214. package/dist/web/assets/Impact-jOSl5Q0k.js +0 -3
  215. package/dist/web/assets/Jobs-DMJGgWtQ.js +0 -5
  216. package/dist/web/assets/KindPage-BbQWH5wa.js +0 -6
  217. package/dist/web/assets/Migration-BBgv7xXo.js +0 -2
  218. package/dist/web/assets/PageAgent-txbNoP6u.js +0 -1
  219. package/dist/web/assets/Product-BrXH81Ns.js +0 -7
  220. package/dist/web/assets/Production-CCVtFNGQ.js +0 -1
  221. package/dist/web/assets/Quality-Dxh-60A8.js +0 -1
  222. package/dist/web/assets/Readiness-DyJvSOLN.js +0 -1
  223. package/dist/web/assets/Record-Dnlkimjb.js +0 -1
  224. package/dist/web/assets/Regression-D2DDTwzs.js +0 -5
  225. package/dist/web/assets/Reports-ClcY7M0Q.js +0 -2
  226. package/dist/web/assets/Response-D9FYUvHg.js +0 -9
  227. package/dist/web/assets/RunDiff-CNImaEdz.js +0 -1
  228. package/dist/web/assets/Runs-CFvmdULI.js +0 -2
  229. package/dist/web/assets/Steps-BS66s0E1.js +0 -2
  230. package/dist/web/assets/TestCases-CrQEUtfD.js +0 -1
  231. package/dist/web/assets/TestData-e3IX0xwG.js +0 -2
  232. package/dist/web/assets/TestDebt-tXPoexMF.js +0 -1
  233. package/dist/web/assets/TestManagement-wjGaoZzI.js +0 -1
  234. package/dist/web/assets/Tosca-C5YaMLS0.js +0 -3
  235. package/dist/web/assets/WhatsNew-CwnRbDnd.js +0 -1
  236. package/dist/web/assets/azuredevops-BcQ5AFOM.js +0 -1
  237. package/dist/web/assets/crew-CWfjZIxE.js +0 -1
  238. package/dist/web/assets/families-DWilSDct.js +0 -1
  239. package/dist/web/assets/filters-CVzIOjPG.js +0 -1
  240. package/dist/web/assets/fold-tvLGnxD1.js +0 -1
  241. package/dist/web/assets/frame-Deu1IqzV.js +0 -13
  242. package/dist/web/assets/index-BWMIKyPB.js +0 -76
  243. package/dist/web/assets/index-C2Yq55oT.css +0 -2
  244. package/dist/web/assets/line-icons-C_amZ5-o.js +0 -1
  245. package/dist/web/assets/logos-C1NBtBMc.js +0 -1
  246. package/dist/web/assets/logos-DFyhMw0i.js +0 -1
  247. package/dist/web/assets/markdown-DC2HA0yZ.js +0 -10
  248. package/dist/web/assets/paletteCommands-Qxm5DZIs.js +0 -1
  249. package/dist/web/assets/parts-BR6dUwqn.js +0 -1
  250. package/dist/web/assets/productParts-BxdHuSBa.js +0 -1
  251. package/dist/web/assets/qualityParts-lz6eYVxC.js +0 -1
  252. package/dist/web/assets/recordTest-CcplpTS6.js +0 -1
  253. package/dist/web/assets/today-DuQFapJM.js +0 -1
  254. package/dist/web/assets/when-CHnpLdYw.js +0 -1
@@ -0,0 +1,371 @@
1
+ # Tabbed interfaces
2
+
3
+ ## Basic markup
4
+
5
+ Instead of manually implementing a roving tabindex or ARIA activedescendant pattern to meet the focus management requirement of the ARIA `tablist` role, we can use `focusgroup` which has a `tablist` behavior and automatically assigns the right roles (`tablist` on the container and `tab` on its focusable children).
6
+
7
+ ```html
8
+ <div class="tabs">
9
+ <div focusgroup="tablist" aria-label="Web platform technologies">
10
+ <button type="button" id="html-tab" aria-selected="true" focusgroupstart>HTML</button>
11
+ <button type="button" id="css-tab">CSS</button>
12
+ <button type="button" id="js-tab">JavaScript</button>
13
+ </div>
14
+ <div role="tabpanel" aria-labelledby="html-tab" tabindex="0"><!-- content for HTML tab --></div>
15
+ <div role="tabpanel" aria-labelledby="css-tab" hidden="until-found"><!-- content for CSS tab --></div>
16
+ <div role="tabpanel" aria-labelledby="js-tab" hidden="until-found"><!-- content for JavaScript tab --></div>
17
+ </div>
18
+ ```
19
+
20
+ DO NOT use this or the WAI-ARIA tabs pattern for page navigation, even if it is intended to be presented as a tabbed interface.
21
+
22
+ Tablist:
23
+ - Prefer `<button>` for the tabs to avoid needing to reimplement button-like behavior. Add `type=button` to avoid unexpected submitter behavior if nested within a form.
24
+ - Use `aria-labelledby` or `aria-label` to give the tablist an accessible name.
25
+ - Use `aria-selected` to indicate which tab is currently selected.
26
+
27
+ Tab panels:
28
+ - Set `role=tabpanel` on the tab panels and use `aria-labelledby` or `aria-label` to give the panel an accessible name (e.g. `aria-labelledby` can reference the associated tab).
29
+ - Do not add `aria-controls` to the tabs: no screen reader uses it.
30
+ - Use `hidden="until-found"` to hide tab panels whose tab is not actively selected while still keeping them searchable by the browser’s find-in-page feature. Use `hidden` with no value to remove the content from the browser's search in-page feature as well.
31
+ - When using `hidden="until-found"`, use the `beforematch` event to sync the tab & tab panel selection state when find-in-page makes a different tab active.
32
+ - Set `tabindex=0` on the visible tab panel if it contains no focusable elements, and remove it from hidden panels.
33
+
34
+ - MANDATORY: Render the initial state in the HTML: `hidden` on every panel except the selected one, and `aria-selected="true"` on the selected tab. Otherwise every panel shows until script runs, overlapping when they share a grid cell.
35
+
36
+ ## Keyboard interaction
37
+
38
+ When it comes to how tabs become selected, one can either make _selection follow focus_ or allow the user to move focus between tabs and perform _selection by activation_.
39
+
40
+ Default to _selection follows focus_.
41
+ It saves a keypress per tab, is more discoverable, and matches native radio groups.
42
+ Use selection by activation instead when showing a panel has a cost the user should opt into, since arrowing from the first tab to the fifth would pay it for every tab along the way:
43
+ - Showing the panel is not instant: content is fetched on demand, or rendering it is noticeably slow.
44
+ - Selecting a tab has side effects: it changes the URL or history, sends analytics, starts media, or saves state.
45
+ - The panel shifts the layout significantly (e.g. panels of very different heights push the rest of the page around).
46
+
47
+ With either pattern, focus entering the group must land on the selected item. By default it returns to the last focused item instead, which is wrong once selection can change without focus (find-in-page, script).
48
+ Use `nomemory` and move `focusgroupstart` to the selected tab:
49
+
50
+ ```html
51
+ <div focusgroup="tablist nomemory" aria-label="Web platform technologies">
52
+ ```
53
+
54
+ ```js
55
+ for (const tab of tabs) {
56
+ tab.ariaSelected = tab === selected;
57
+ tab.toggleAttribute('focusgroupstart', tab === selected);
58
+ }
59
+ ```
60
+
61
+ ## Styling
62
+
63
+ ### Indicating the selected tab
64
+
65
+ Style the selected tab from `aria-selected`, so the visual state can never disagree with the accessible one.
66
+ Do not apply any styling that changes the dimensions of the tab (e.g., `padding`, `border`, `margin`, `font-size`, `font-weight`, etc).
67
+
68
+ - MANDATORY: Do not indicate the selected tab with color alone (WCAG 1.4.1). Add a shape, such as an underline.
69
+ - Draw the underline with a border on a pseudo-element. DO NOT use `box-shadow` or a background: forced colors mode removes both, leaving no indicator.
70
+
71
+ ```css
72
+ [role="tab"] {
73
+ position: relative;
74
+ }
75
+
76
+ [aria-selected="true"] {
77
+ color: var(--accent);
78
+
79
+ /* Example: a 3px underline that takes no space */
80
+ &::after {
81
+ content: "";
82
+ position: absolute;
83
+ inset: auto 0 0;
84
+ border-block-end: 3px solid var(--accent);
85
+ }
86
+ }
87
+ ```
88
+
89
+ To animate the underline between tabs, move the pseudo-element to the tablist and tether it to the selected tab with anchor positioning. See `anchor-positioning-tab-underline` for details.
90
+
91
+
92
+ - DO NOT put padding, borders, margins, or backgrounds on the panel element itself. `hidden=until-found` does not use `display: none`: it only hides the panel's contents, so a hidden panel still renders its padding, border, margin, and background as an empty strip. Put these styles on a child wrapper inside the panel instead.
93
+ - `hidden=until-found` panels still participate in grid and flex layout, so `gap` adds space for every hidden panel. Place all panels in the same grid cell, or avoid `gap` between panels.
94
+
95
+ See `search-hidden-content` (references/ui-behaviors/search-hidden-content.md) for more details.
96
+
97
+ ## Handling tabs that don’t fit
98
+
99
+ Keep tabs on a single row. DO NOT wrap them onto multiple rows: wrapped rows make the tab order and the selected tab hard to follow.
100
+ When the tabs are wider than the available space, either scroll the tablist or move the tabs that don’t fit into a popup menu.
101
+ Optionally, also shrink the inactive tabs, so more tabs fit before either kicks in.
102
+
103
+ 1. **Scrolling** keeps every tab in the tablist and in the keyboard order, and works with touch swiping. It needs no script beyond selection. Use it by default, and always on touch-first interfaces.
104
+ 2. **An overflow menu** shows the names of all hidden tabs at once, in a list, without scrolling. Use it when there are a few primary tabs and a tail of less used ones, and users mostly use a pointer. It needs script to detect overflow.
105
+ 3. **Shrinking inactive tabs** truncates their labels, so it suits tabs the user creates (e.g. open documents in an editor) better than a fixed set of tabs with short labels. Combine it with scrolling or an overflow menu.
106
+
107
+ ### Strategy 1: scrolling
108
+
109
+ 1. Make the tablist a horizontal scroll container: `display: flex`, `overflow-x: auto`, and `flex: none` on the tabs so they never shrink (unless combined with strategy 3).
110
+ 2. Optional: snap to tab edges with `scroll-snap-type: inline proximity` on the tablist and `scroll-snap-align: start` on the tabs. Use `proximity`, not `mandatory`, so the user can still stop between tabs.
111
+ 3. Hide the scrollbar and fade out each edge of the tablist that has more tabs beyond it, as described below. A fade suits a row of tabs better than a shadow, and works on any background. See `scrollability-affordance-hints` for more details on scrollability hints.
112
+ 4. On every selection change, scroll the selected tab into view with `scrollIntoView({ block: 'nearest', inline: 'nearest', container: 'nearest' })`. `container: 'nearest'` scrolls only the tablist, not the page. Clicking a partially visible tab then reveals it along with part of the next one, so mouse users without a horizontal scroll wheel can still reach every tab. It also covers selection without focus, such as find-in-page.
113
+
114
+ #### Fading the edges
115
+
116
+ Fade the content with a mask on the scroller itself: an opaque layer minus a gradient band at each end. Masking only the bands keeps everything else visible, including a focus outline on the scroller, which a single gradient clipped to the border box would hide. Animate each band's size with a scroll-driven animation on the scroller's own scroll position: each fade grows from 0 as the user scrolls away from that end, and shrinks back to 0 as they reach the other end. When the content fits, the scroll timeline is inactive and there is no fade.
117
+
118
+ ```css
119
+ @property --fade-start {
120
+ syntax: "<length>";
121
+ inherits: false;
122
+ initial-value: 0px;
123
+ }
124
+
125
+ @property --fade-end {
126
+ syntax: "<length>";
127
+ inherits: false;
128
+ initial-value: 0px;
129
+ }
130
+
131
+ .scroller {
132
+ overflow-x: auto;
133
+ /* Example value: how far each fade reaches */
134
+ --fade-size: 3rem;
135
+ /* Gradient directions and positions are physical, so flip them for right-to-left content */
136
+ --fade-dir: right;
137
+ --fade-start-pos: 0;
138
+ --fade-end-pos: 100%;
139
+ mask:
140
+ linear-gradient(black, black) no-clip subtract,
141
+ linear-gradient(to var(--fade-dir), black, transparent) var(--fade-start-pos) 0 / var(--fade-start) 100% no-repeat no-clip,
142
+ linear-gradient(to var(--fade-dir), transparent, black) var(--fade-end-pos) 0 / var(--fade-end) 100% no-repeat no-clip;
143
+ animation: reveal-fade-start linear both, hide-fade-end linear both;
144
+ animation-timeline: scroll(self inline);
145
+ /* Each fade animates over the first or last --fade-size of scrolling */
146
+ animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
147
+
148
+ &:dir(rtl) {
149
+ --fade-dir: left;
150
+ --fade-start-pos: 100%;
151
+ --fade-end-pos: 0;
152
+ }
153
+ }
154
+
155
+ @keyframes reveal-fade-start {
156
+ to {
157
+ --fade-start: var(--fade-size);
158
+ }
159
+ }
160
+
161
+ @keyframes hide-fade-end {
162
+ from {
163
+ --fade-end: var(--fade-size);
164
+ }
165
+ }
166
+ ```
167
+
168
+ - MANDATORY: Register `--fade-start` and `--fade-end` with `@property`. Unregistered custom properties do not interpolate, so the fades would jump.
169
+ - Set `scroll-padding-inline` (or `scroll-padding-block`) to the fade size if the scroller uses scroll snapping or contains focusable items, so snapped and focused items never stop inside a fade.
170
+ - For vertical scrollers, use `to bottom`, put the bands at `0 0` and `0 100%` with sizes `100% var(--fade-start)` and `100% var(--fade-end)`, and use `scroll(self block)` and `overflow-y`.
171
+ - For right-to-left content, flip `--fade-dir` and swap the band positions, as in the `:dir(rtl)` rule above. The scroll timeline follows the writing direction, but gradient directions and mask positions are physical.
172
+
173
+ ### Strategy 2: overflow menu
174
+
175
+ Hide the tabs that don’t fit and list them in a menu opened by a “More” button after the tablist.
176
+ Build the button and its menu as a menu button; see `menu` (references/ui-components/menu.md) for structure, positioning, and keyboard behavior.
177
+ The rest of this section covers only what is specific to tabs.
178
+
179
+ - **Place the “More” button outside the tablist.** A tablist may only contain tabs. This makes it a separate `Tab` stop that arrow keys do not reach. If arrow-key access matters more, move focus from the last visible tab to the “More” button on `ArrowRight`/`End`, and back on `ArrowLeft`. The tablist itself does nothing at its last tab, so this does not conflict with it, but it is custom key handling that users of the tab pattern may not expect.
180
+ - **Make the “More” button look different from a tab.** Use an icon (such as a horizontal ellipsis) with an accessible name, not a text label: a text label looks like one more tab.
181
+ - **Detect overflow with `IntersectionObserver`**, rooted at the tablist with `threshold: 1`, so partially visible tabs count as overflowed. It reports each tab as it starts or stops fitting, with no layout math.
182
+ - **Hide overflowed tabs with `visibility: hidden`**, not `display: none` or `hidden`. They keep their layout box, so the observer still reports when they fit again, and they leave the focus order and the accessibility tree. Set `overflow: clip` on the tablist so they don’t overflow the page.
183
+ - **Mirror each tab as a `menuitem`**. Show only the items whose tab is hidden. Activating an item selects its tab and focuses it. Focus the tab before hiding the popover: otherwise the popover returns focus to the previously focused tab, which selects it again.
184
+ - **Hide the “More” button when no tab overflows.** This cannot loop: showing the button only narrows the tablist, so at least one tab still overflows.
185
+ - **Keep the selected tab in the tablist.** DO NOT leave it in the menu or mark the “More” button as selected: it is a button, not a tab. When the selected tab overflows (selected from the menu, by find-in-page, or after a resize), set `display: none` on the tabs before it, closest first, until it fits. The observer then reports them as overflowed, so they appear in the menu. DO NOT reorder tabs (in the DOM or with CSS `order`): the removed tabs are gone from both the visual and the focus order, so the two still match. Keep overflowed tabs visible while they are selected or focused: a selected tab can then be focused before the observer catches up, and a focused tab keeps focus when a resize overflows it.
186
+
187
+ ```html
188
+ <div class="tabs">
189
+ <div class="tablist" focusgroup="tablist nomemory" aria-label="Product details">
190
+ <button type="button">Overview</button>
191
+ <button type="button">Specifications</button>
192
+ <!-- … -->
193
+ </div>
194
+ <!-- Outside the tablist: a tablist may only contain tabs.
195
+ Icon, not text, so it does not read as another tab. -->
196
+ <button type="button" class="more" hidden aria-label="More tabs" aria-haspopup="menu" aria-expanded="false">⋯</button>
197
+ <!-- Menu: see the menu guide. One menuitem per tab. -->
198
+ <!-- Tab panels -->
199
+ </div>
200
+ ```
201
+
202
+ ```js
203
+ const observer = new IntersectionObserver(entries => {
204
+ for (const { target: tab, intersectionRatio } of entries) {
205
+ const overflowed = intersectionRatio < 1;
206
+ // CSS: .clipped:not([aria-selected="true"], :focus) { visibility: hidden; }
207
+ tab.classList.toggle('clipped', overflowed);
208
+ menuItemFor(tab).hidden = !overflowed;
209
+ }
210
+ more.hidden = !tabs.some(tab => tab.classList.contains('clipped'));
211
+ reveal();
212
+ }, { root: tablist, threshold: 1 });
213
+
214
+ tabs.forEach(tab => observer.observe(tab));
215
+
216
+ // Also call after every selection change.
217
+ // CSS: .displaced { display: none; }
218
+ function reveal() {
219
+ const tab = tabs.find(tab => tab.ariaSelected === 'true');
220
+ const before = tabs.slice(0, tabs.indexOf(tab));
221
+ tabs.forEach(tab => tab.classList.remove('displaced'));
222
+ while (before.length && !fits(tab)) {
223
+ before.pop().classList.add('displaced');
224
+ }
225
+ }
226
+
227
+ // Checks both edges, so it works in either writing direction
228
+ function fits(tab) {
229
+ const list = tablist.getBoundingClientRect();
230
+ const { left, right } = tab.getBoundingClientRect();
231
+ return left >= list.left && right <= list.right;
232
+ }
233
+ ```
234
+
235
+ ### Strategy 3: Making inactive tabs smaller
236
+
237
+ This may be combined with the overflow handling strategies described above to allow more tabs to fit before scrolling or showing a menu.
238
+ It is more well suited to user-driven tablists (e.g. a document editor) rather than hardcoded UI tablists.
239
+
240
+ - Let inactive tabs shrink and keep the selected tab at its full width: `flex: 0 1 auto` on the tabs, and `min-inline-size: max-content` on the selected tab, which also overrides any `max-inline-size`, so its label is never truncated. DO NOT use `flex-shrink: 0` for this: it cannot transition smoothly (see below).
241
+ - Set a `min-inline-size` on the tabs. Once every inactive tab is at its minimum, the remaining overflow is handled by scrolling or the overflow menu.
242
+ - Truncate shrunk labels with `text-overflow: ellipsis`. Put the label in its own element, so `overflow: hidden` applies to the text only and an icon beside it is never clipped.
243
+ - Keep the full label in the DOM, so the accessible name and find-in-page are unaffected. Reveal it by scrolling the label inside the tab on hover, and on focus when activation is manual (with automatic activation the focused tab is selected, so it is already full width). See `single-line-overflow` for more details.
244
+ - If tabs have icons, keep the icon visible and truncate only the label, so a minimum-width tab is still recognizable.
245
+ - Transition `min-inline-size` so tabs resize smoothly when the selection changes, instead of jumping. Set `interpolate-size: allow-keywords` on the tablist so it interpolates to and from `max-content`; no view transition is needed. Only transition it when `prefers-reduced-motion` is `no-preference`. Transitioning `flex-shrink` does not work: any value above 0 shrinks a tab all the way to its minimum when the tabs overflow.
246
+
247
+
248
+
249
+ ## Fallback strategies
250
+
251
+ ### Fallbacks & browser support for focusgroup
252
+
253
+ Browser support for focusgroup: Limited availability.
254
+ Supported by: Chrome 150 (Jun 2026) and Edge 150 (Jul 2026).
255
+ Unsupported in: Firefox and Safari.
256
+
257
+ Load `@microsoft/focusgroup-polyfill` only when native support is missing:
258
+
259
+ ```js
260
+ if (!(Object.hasOwn(HTMLElement.prototype, 'focusGroup'))) {
261
+ const { polyfill } = await import('@microsoft/focusgroup-polyfill');
262
+ polyfill();
263
+ }
264
+ ```
265
+
266
+ - Use the `focusgroup` and `focusgroupstart` attributes, not the `focusGroup` property, which the polyfill does not add.
267
+ - The polyfill does not notice items hidden or shown later: add `focusgroup="none"` to an item while it is hidden.
268
+
269
+ ### Fallbacks & browser support for `hidden=until-found`
270
+
271
+ Browser support for hidden="until-found": Limited availability.
272
+ Supported by: Chrome 102 (May 2022), Edge 102 (May 2022), and Firefox 148 (Feb 2026).
273
+ Unsupported in: Safari.
274
+
275
+ Treat `hidden=until-found` as an enhancement. Do not polyfill it: find-in-page cannot be reproduced across browsers.
276
+ No feature detection is needed when setting it from script: in browsers without support, `panel.hidden = 'until-found'` sets the boolean `hidden`, so the panel is simply hidden and not searchable.
277
+
278
+ ### Fallbacks & browser support for `interpolate-size`
279
+
280
+ Browser support for interpolate-size: Limited availability.
281
+ Supported by: Chrome 129 (Sep 2024) and Edge 129 (Sep 2024).
282
+ Unsupported in: Firefox and Safari.
283
+
284
+ No fallback is needed: without `interpolate-size`, tabs resize instantly instead of transitioning.
285
+
286
+ ### Fallbacks & browser support for scroll-driven animations
287
+
288
+ Baseline status for Scroll-driven animations: Newly available. It's been Baseline since 2026-10-27.
289
+ Supported by: Chrome 115 (Jul 2023), Edge 115 (Jul 2023), Firefox 159 (Oct 2026), and Safari 26 (Sep 2025).
290
+
291
+ Without scroll-driven animations, the fades are never shown, and neither are the shadows if scroll-state queries are also unsupported. Use one of these last-resort fallbacks.
292
+
293
+ #### Shadows on a solid background: background attachment
294
+
295
+ If the scroller has a solid background color, draw the shadows with backgrounds instead. This works in every browser and needs no JavaScript.
296
+ Each shadow is a `scroll` background, which stays at the edge of the scrollport.
297
+ Each shadow has a cover: a `local` background in the scroller's own color, which scrolls with the content.
298
+ At either end of the content its cover sits on top of its shadow and hides it; once the user scrolls away from that end, the cover moves away and the shadow shows.
299
+
300
+ ```css
301
+ @supports not ((container-type: scroll-state) or (animation-timeline: scroll())) {
302
+ .scroller {
303
+ background:
304
+ /* Covers: scroll with the content. Must use the scroller's own background color. */
305
+ linear-gradient(var(--surface) 30%, transparent) top / 100% 2.5rem no-repeat local,
306
+ linear-gradient(transparent, var(--surface) 70%) bottom / 100% 2.5rem no-repeat local,
307
+ /* Shadows: stay at the edges of the scrollport */
308
+ radial-gradient(farthest-side at 50% 0, rgb(0 0 0 / .15), transparent) top / 100% .75rem no-repeat,
309
+ radial-gradient(farthest-side at 50% 100%, rgb(0 0 0 / .15), transparent) bottom / 100% .75rem no-repeat,
310
+ var(--surface);
311
+ }
312
+ }
313
+ ```
314
+
315
+ The shadows paint behind the content, so content with its own opaque background hides them. In that case, use the `IntersectionObserver` fallback below.
316
+
317
+ #### Fades, or shadows on any background: `IntersectionObserver`
318
+
319
+ Use an `IntersectionObserver` to mark which edges have more content, and show the hints from those attributes. Observe the scroller's first and last children, with the scroller as the root and `threshold: 1`: a child that is not fully visible means there is more content beyond it.
320
+
321
+ ```js
322
+ if (!CSS.supports('animation-timeline', 'scroll()')) {
323
+ for (const scroller of document.querySelectorAll('.scroller')) {
324
+ const [first, last] = [scroller.firstElementChild, scroller.lastElementChild];
325
+ // rootMargin: without it, sub-pixel widths can leave an edge child a fraction of a pixel short of fully visible
326
+ const observer = new IntersectionObserver(entries => {
327
+ for (const { target, intersectionRatio } of entries) {
328
+ scroller.classList.toggle(target === first ? 'more-start' : 'more-end', intersectionRatio < 1);
329
+ }
330
+ }, { root: scroller, threshold: 1, rootMargin: '1px' });
331
+
332
+ observer.observe(first);
333
+ observer.observe(last);
334
+ }
335
+ }
336
+ ```
337
+
338
+ ```css
339
+ /* Shadows */
340
+ .scroller.more-start::before,
341
+ .scroller.more-end::after {
342
+ opacity: 1;
343
+ }
344
+
345
+ /* Fades */
346
+ .scroller {
347
+ transition: --fade-start .2s, --fade-end .2s;
348
+
349
+ &.more-start {
350
+ --fade-start: var(--fade-size);
351
+ }
352
+
353
+ &.more-end {
354
+ --fade-end: var(--fade-size);
355
+ }
356
+ }
357
+ ```
358
+
359
+ If a single child can be larger than the scroller (e.g. one long article), it is never fully visible, so this would always show both hints. Observe sentinels instead: empty elements that the script adds at each end of the scroller. A sentinel that is out of view means there is more content beyond it.
360
+
361
+ ```js
362
+ // Must be valid children of the scroller (e.g. <li aria-hidden="true"> in a list)
363
+ const [start, end] = [document.createElement('div'), document.createElement('div')];
364
+ for (const sentinel of [start, end]) {
365
+ // A zero-size sentinel at the very edge never counts as intersecting
366
+ sentinel.style.cssText = 'min-inline-size: 1px; min-block-size: 1px';
367
+ }
368
+ scroller.prepend(start);
369
+ scroller.append(end);
370
+ // Observe them as above, with the default threshold, using !isIntersecting instead of intersectionRatio < 1
371
+ ```
@@ -0,0 +1,277 @@
1
+ # Build a toolbar
2
+
3
+ A toolbar groups related controls (formatting, alignment, view options) into one composite widget with a **single tab stop**. Users `Tab` into it once, move between controls with the arrow keys, and `Tab` out. Use it only for controls that act on something else (an editor, preview, canvas). For site navigation, see `navbar` (references/ui-components/navbar.md); for a dropdown or context menu of commands without a persistent row of controls, see `menu` (references/ui-components/menu.md).
4
+
5
+ ## Structure and semantics
6
+
7
+ MANDATORY: Put `role="toolbar"` and an `aria-label` on the container. Wrap related controls in `role="group"` with their own `aria-label`, and divide groups with `role="separator"` and `aria-orientation="vertical"`. If a wrapped separator would sit alone at a row end, hide it visually with `opacity: 0`, not `display: none` or `visibility: hidden`, which also remove it from the accessibility tree. Optionally add `aria-controls` pointing at the element the toolbar acts on; it is only worth adding when the toolbar controls one specific element.
8
+
9
+ * Use real `<button type="button">` elements.
10
+ * Icon-only buttons need an `aria-label`; tooltips do not replace it. Render decorative icons with `<svg aria-hidden="true">` and `currentColor`, or with a CSS `mask`, `background-color: currentColor`, and `forced-color-adjust: none` so forced-colors mode does not strip the fill. For a reusable CSS icon token system, see `icons`.
11
+ * Toggle buttons (bold, italic) use `aria-pressed="true|false"`. Do not change their label when toggled.
12
+ * A mutually exclusive set (left/center/right) uses `aria-pressed` on each button, with script keeping exactly one `true`.
13
+ * Action buttons (copy, undo, save) run once and have no on/off state, so DO NOT add `aria-pressed` to them. Mark `aria-pressed` only on buttons that stay on or off.
14
+ * Disable with `aria-disabled="true"` rather than `disabled` so the control stays focusable and reachable by arrow keys. Ignore clicks while it is set.
15
+
16
+ ```html
17
+ <div role="toolbar" focusgroup="toolbar wrap" aria-label="Text formatting" aria-controls="preview">
18
+ <div role="group" aria-label="Style">
19
+ <button type="button" aria-pressed="false" aria-label="Bold" title="Bold"></button>
20
+ </div>
21
+ <span role="separator" aria-orientation="vertical"></span>
22
+ <!-- Overflow trigger: the last item in the toolbar -->
23
+ <button type="button" aria-label="More actions" aria-haspopup="menu" aria-expanded="false"
24
+ popovertarget="more-menu" title="More actions"></button>
25
+ </div>
26
+ ```
27
+
28
+ ## Action buttons and feedback
29
+
30
+ Toggles show their result through `aria-pressed`. An action has no state to show, so a screen reader user gets no confirmation unless you provide it. When the result is not otherwise visible or announced (copy, save), write a short message to a live region outside the toolbar. If the action changes content that is already announced or focused, skip the message.
31
+
32
+ ```html
33
+ <!-- Always present in the DOM so the announcement is reliable; keep it outside the toolbar -->
34
+ <p role="status"></p>
35
+ ```
36
+
37
+ ```js
38
+ // Report the outcome, including failure; clipboard access can be denied
39
+ try {
40
+ await navigator.clipboard.writeText(text);
41
+ status.textContent = "Text copied";
42
+ } catch {
43
+ status.textContent = "Copy failed";
44
+ }
45
+ ```
46
+
47
+ ## Keyboard navigation
48
+
49
+ MANDATORY: Only one item is in the tab order at a time. Put `focusgroup="toolbar wrap"` on the `role="toolbar"` container: the browser provides the roving tab stop, arrow-key movement across all groups (wrapping at the ends, reversed in RTL), `Home`/`End`, and focus restoration after a click. Do not add a second roving-tabindex system alongside it. Where `focusgroup` is unsupported, install the fallback in "Fallbacks" below.
50
+
51
+ ## Vertical toolbar
52
+
53
+ Choose a vertical toolbar when controls stack along a side edge (a tool palette or zoom controls beside a canvas); otherwise use a horizontal one. Everything above applies except:
54
+
55
+ * Set `aria-orientation="vertical"` on the toolbar and use `focusgroup="toolbar wrap block"` so `ArrowDown`/`ArrowUp` move between items.
56
+ * Lay items out in a column (`flex-direction: column`, no wrapping).
57
+ * A separator between stacked items is horizontal: use `aria-orientation="horizontal"` (the separator default) there, not `vertical`.
58
+ * Tooltips open beside the button (`position-area: inline-end`), not below it; see Tooltips below.
59
+
60
+ ## Visible states
61
+
62
+ * Size each button at least 24×24 CSS px using `min-inline-size`/`min-block-size` (not `inline-size`/`block-size`), so content can grow the target but never shrink it. Enlarge it under `@media (pointer: coarse)`. Values like `2.5rem` and `3rem` are examples.
63
+
64
+ * Keep a clear `:focus-visible` outline with an offset; never remove it.
65
+ * Style toggled state from the ARIA attribute (`[aria-pressed="true"]`), not a separate class, so visual and accessible state cannot diverge.
66
+ * Show the toggled state by changing the button background; if the contrast between the button background and the adjacent background color is less than 3:1 in each supported color scheme, provide an additional visual cue such as an outline or inset shadow around the background that meets the 3:1 threshold. For more information, see `color` (references/visual-design/color.md).
67
+ * Under `forced-colors: active`, use system colors (`ButtonText`, `Highlight`).
68
+ * Draw separators and tooltip boxes with a border (a `transparent` one is fine), not `background` alone, which forced colors replaces with the page color.
69
+ * Wrap hover styles in `@media (hover: hover)` and transitions in `@media (prefers-reduced-motion: no-preference)`.
70
+
71
+ ## Tooltips for icon-only buttons
72
+
73
+ Give each icon-only button a `title` as the baseline tooltip. Only where both interest invokers and anchor positioning are supported, upgrade it to an interest invoker with `popover="hint"`, which shows the tooltip without closing an open menu popover. Elsewhere the native `title` tooltip stays.
74
+
75
+ MANDATORY: Position the hint on the axis the toolbar does not stack along: `position-area: block-end` (fallback `flip-block`) for a horizontal toolbar, `position-area: inline-end` (fallback `flip-inline`) for a vertical one. A hint placed along the stacking axis covers the next control and swallows its click, because the hint stays open while the pointer is over it.
76
+
77
+ ```html
78
+ <button type="button" aria-label="Bold" title="Bold">…</button>
79
+ ```
80
+
81
+ ```js
82
+ // Upgrade title tooltips only when interest invokers and anchor positioning both work
83
+ if ("interestForElement" in HTMLButtonElement.prototype && CSS.supports("position-area", "block-end")) {
84
+ document.querySelectorAll('[role="toolbar"] button[title]').forEach((b, i) => {
85
+ const tip = Object.assign(document.createElement("div"), { id: `tip-${i}`, textContent: b.title });
86
+ tip.popover = "hint";
87
+ b.setAttribute("interestfor", tip.id);
88
+ b.removeAttribute("title"); // avoid a second, native tooltip
89
+ document.body.append(tip); // keep open hint nodes out of role="group" / role="toolbar"
90
+ });
91
+ }
92
+ ```
93
+
94
+ `interestfor` is specified to wire hint popovers (`popover="hint"`) for assistive technology itself, based on what the target contains. A **plain hint** (text and images only) becomes the trigger's accessible description, or its name if it has none. A **rich hint** (headings, links, or other interactive content) gets a minimum role of `tooltip`, the trigger gets `aria-expanded` and an `aria-details` relation while the hint is open, and the open hint comes right after the trigger in the tab order so keyboard users can reach its content.
95
+
96
+ Browsers and screen readers do not yet expose this consistently, so add explicit ARIA as well:
97
+
98
+ - **Hint that repeats the trigger's accessible name** (e.g. an icon-only button with `aria-label="Bold"` and a "Bold" tooltip): add nothing. A description identical to the name would be read twice.
99
+ - **Hint on a trigger with no visible label of its own** (e.g. an icon-only button without `aria-label`): `aria-labelledby` on the trigger pointing at the hint, so the hint becomes the name.
100
+ - **Hint whose trigger also opens it on activation** (a toggletip, or any button whose only job is the hint: give it `popovertarget` with `popovertargetaction="show"`): `role="tooltip"` on the hint and `aria-expanded` on the trigger, kept in sync with the popover's `toggle` event. A description read right after "button" suggests further actions and muddles the role; the expanded state tells the user there is content to reveal and whether it is open, and pressing the button delivers it. Place the hint right after the trigger in the DOM so reading keys reach its content once it is open.
101
+ - **Hint whose trigger does something else on activation** (a link, a button with its own action): `role="tooltip"` on the hint and `aria-describedby` on the trigger, never `aria-expanded`. A trigger announced as "collapsed" suggests `Enter` would expand it, but `Enter` navigates or acts. The hint must be something the user can afford to miss: a hovercard previews the destination, a tooltip on an action button describes the action.
102
+ - **DO NOT** attach a hint that opens on activation to a control that already uses `aria-expanded` for something else (for example, a menu button). Give that hint its own trigger instead.
103
+ - **DO NOT** move focus into the target when interest is shown (no `autofocus`, no `focus()` in an `interest` listener). Interest is triggered by hover or focus alone, so moving focus would fail WCAG 3.2.1 (On Focus).
104
+
105
+ Not every screen reader reads descriptions when moving through the page (NVDA skips them in browse mode by design), so a hint exposed as a description must only carry content the user can afford to miss. Link previews and tooltips on action controls qualify; anything the user needs belongs in a toggletip or inline.
106
+
107
+ Wire this with a short script instead of hand-authoring the attributes, so the markup stays declarative and the same rules apply to every hint. The script should:
108
+
109
+ 1. Run in every browser, before loading the `interestfor` polyfill, once the DOM is parsed, and expose a function that can be called again for content inserted later. Scanning upfront is required: a browse-mode screen reader user needs the attributes in place before any interaction, so wiring them lazily on `focus` or `interest` is too late, and so is waiting for the polyfill, which wires its ARIA only on `load` and adds no `role="tooltip"` to plain hints.
110
+ 2. For every `[interestfor]` trigger whose target has `popover="hint"`, normalize whitespace and compare the hint text with the trigger's accessible name (`aria-labelledby` targets, else `aria-label`, else text content including image `alt`, else `title`). Equal: do nothing. Otherwise set `role="tooltip"` on the hint if it has no role.
111
+ 3. When the trigger has no name, point `aria-labelledby` at the hint unless it already has one. Otherwise, if the trigger also opens the hint on activation (a `popovertarget` or `commandfor` naming the hint), set `aria-expanded` to the popover's current state (`:popover-open`) unless it already has `aria-expanded`, and remember which triggers the script owns; if not, point `aria-describedby` at the hint unless it already has one.
112
+ 4. Keep `aria-expanded` in sync from the popover's `toggle` event in every browser with a single capturing listener on `document`, updating every trigger with a matching `interestfor` that the script owns (the `interestfor` polyfill does not sync `aria-expanded` on plain-text hints or when a toggletip is opened via `popovertarget`).
113
+
114
+ Things that are easy to get wrong:
115
+
116
+ - `toggle` does not bubble. A bubbling listener on `document` never fires; use the capture phase (or a listener per popover).
117
+ - Sync `aria-expanded` from `toggle`, not from `interest`/`loseinterest`. The popover is the source of truth: it can be closed by `Escape`, light dismiss, or another invoker, and several triggers can share one hint.
118
+ - A hidden popover is a valid `aria-describedby` or `aria-labelledby` target. Do not force the hint open or duplicate its text to make it "visible".
119
+ - Do not add `aria-haspopup` or a live region to any hint.
120
+ - Do not override author ARIA: an existing `aria-describedby`, `aria-labelledby`, or `aria-expanded` on the trigger wins.
121
+
122
+ By default, interest is shown and lost for keyboard and mouse users with a delay of half a second. This prevents the targeted popover from opening while tabbing through a page or moving your mouse around, and from closing while moving your mouse from the trigger to the popover. To adjust the timing, use the `interest-delay` CSS property.
123
+
124
+ ```css
125
+ [interestfor]{
126
+ /* Shorthand for interest-delay-start and interest-delay-end */
127
+ interest-delay: 0.2s 0.1s;
128
+ }
129
+ ```
130
+
131
+ If users are likely to move through multiple triggers in quick succession, set the initial delay to `0s` if an interest-triggered popover is already open. To prevent performance issues with `:has()`, select a nearby container with a small number of child nodes, and target the triggers as directly as possible.
132
+
133
+ ```css
134
+ .container:has( > li > a:interest-source) [interestfor] {
135
+ interest-delay-start: 0s;
136
+ }
137
+ ```
138
+
139
+ ```css
140
+ [popover="hint"] {
141
+ inset: auto;
142
+ /* Anchor to the invoker; flip to the other side if there is no room */
143
+ position-area: block-end;
144
+ position-try-fallbacks: flip-block;
145
+ }
146
+ ```
147
+
148
+ ## Overflow menu for secondary actions (optional)
149
+
150
+ Two patterns fit a toolbar into a narrow space: an overflow menu, better on desktop, or a horizontally scrollable toolbar with no scrollbar and scroll hints, better on mobile. For the scrollable pattern use `overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity`, and hint at hidden controls with edge fades (`mask-image`) or a partly visible last item. Choose by input type (`@media (pointer: coarse)`) or container width.
151
+
152
+ Add a trailing "More actions" menu when the toolbar has secondary actions or must fit narrow containers; skip it if every control is common and fits. If items must move into the menu dynamically as space runs out, build that overflow behavior yourself.
153
+
154
+ * Make the trigger the last toolbar item (`aria-label="More actions"`, `aria-haspopup="menu"`, `aria-expanded="false"`, and `popovertarget` pointing at the menu popover) with the conventional three vertical dots icon (`⋮`). Open it only on activation—never preview on focus when arrowing across the toolbar.
155
+ * Anchor the `popover` container to its trigger (`inset: auto; position-area: block-end span-inline-start; position-try-fallbacks: flip-block, flip-inline`) and nest `<div focusgroup="menu nomemory" aria-label="More actions">` inside it, adding `role="menu"`, `role="menuitem"`, `tabindex="-1"`, and `ArrowDown`/`ArrowUp`/`Home`/`End` only when `'focusGroup' in HTMLElement.prototype` is false. Sync `aria-expanded` and focus the first item on `toggle`, close the popover on `Tab` without trapping focus, and let `Space` on `role="menuitemcheckbox"` toggle `aria-checked` without closing. For nested submenus or radio groups, see `menu` (references/ui-components/menu.md).
156
+ * Announce the result of every menu activation in the toolbar's live region, such as `"Strikethrough on"` or `"Formatting cleared"`. When closing the menu returns focus to the trigger, delay the live-region write slightly—for example `500ms`—so the focus-change announcement does not preempt it.
157
+
158
+ ## Fallback strategies
159
+
160
+ ### Fallbacks & browser support for `focusgroup`
161
+
162
+ Browser support for focusgroup: Limited availability.
163
+ Supported by: Chrome 150 (Jun 2026) and Edge 150 (Jul 2026).
164
+ Unsupported in: Firefox and Safari.
165
+
166
+ Keep `focusgroup` in the markup. Only if `'focusGroup' in HTMLElement.prototype` is false, load a roving-tabindex fallback; never install it when native focusgroup is present. The fallback implements what focusgroup does natively:
167
+
168
+ * The active item has `tabindex="0"`; all others have `tabindex="-1"`. Initially the first item is active.
169
+ * On `focusin`, move `tabindex="0"` to the focused item so returning to the toolbar (including after a click) restores position.
170
+ * In a horizontal toolbar, `ArrowRight`/`ArrowLeft` move to the next/previous item across all groups and wrap at the ends. In RTL, reverse the directions. Do not wire `ArrowUp`/`ArrowDown`.
171
+ * In a vertical toolbar, `ArrowDown`/`ArrowUp` move to the next/previous item instead, and `ArrowLeft`/`ArrowRight` do nothing.
172
+ * `Home`/`End` move to the first/last item.
173
+ * Call `preventDefault()` only for keys the toolbar handles so `Tab` keeps working.
174
+
175
+ ```js
176
+ if (!('focusGroup' in HTMLElement.prototype)) {
177
+ // items = every toolbar control across all groups, in DOM order
178
+ items.forEach((b, i) => (b.tabIndex = i ? -1 : 0));
179
+ bar.addEventListener("focusin", ({ target }) => {
180
+ if (items.includes(target)) items.forEach((b) => (b.tabIndex = b === target ? 0 : -1));
181
+ });
182
+ // Read direction and orientation at event time so runtime changes are honored
183
+ const vertical = bar.getAttribute("aria-orientation") === "vertical";
184
+ // Only horizontal toolbars flip with direction: RTL does not flip Up/Down
185
+ const rtl = getComputedStyle(bar).direction === "rtl";
186
+ const steps = vertical
187
+ ? { ArrowDown: 1, ArrowUp: -1 }
188
+ : { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 };
189
+ // keydown: look up steps[key] (or Home/End), move focus, preventDefault only for handled keys
190
+ }
191
+ ```
192
+
193
+ ### Fallbacks & browser support for Interest invokers
194
+
195
+ Browser support for Interest invokers: Limited availability.
196
+ Supported by: Chrome 149 (Jun 2026) and Edge 149 (Jun 2026).
197
+ Unsupported in: Firefox and Safari.
198
+
199
+ Do not load an `interestfor` polyfill here: when native interest invokers or anchor positioning are missing, the upgrade script is skipped and buttons keep their baseline `title` tooltip.
200
+
201
+ ### Fallbacks & browser support for Popover
202
+
203
+ Baseline status for Popover: Newly available. It's been Baseline since 2025-01-27.
204
+ 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).
205
+
206
+ 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.
207
+
208
+ **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.
209
+
210
+ With a bundler or import map:
211
+
212
+ ```js
213
+ // MANDATORY: Feature detect 'popover' on HTMLElement.prototype.
214
+ if (!Object.hasOwn(HTMLElement.prototype, "popover")) {
215
+ import("@oddbird/popover-polyfill");
216
+ }
217
+ ```
218
+
219
+ If not using a package manager, import from a CDN, e.g. `"https://unpkg.com/@oddbird/popover-polyfill@latest/dist/popover.min.js"`.
220
+
221
+ Caveats when using the polyfill:
222
+ - 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.
223
+ - **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:
224
+
225
+ ```css
226
+ [popover]:is(:popover-open, .\:popover-open) {
227
+ display: block;
228
+ }
229
+ ```
230
+
231
+ ### Fallbacks & browser support for `popover="hint"`
232
+
233
+ Browser support for popover="hint": Limited availability.
234
+ Supported by: Chrome 151 (Jul 2026), Edge 151 (Jul 2026), and Firefox 153 (Jul 2026).
235
+ Unsupported in: Safari.
236
+
237
+ The popover polyfill does not add `popover="hint"`. Where `popover` exists without `hint`, two tooltips can stay open at once (for example one opened by focus and one by hover). Treat this as graceful degradation: the upgrade only runs where interest invokers are supported, and other browsers keep the native `title` tooltip.
238
+
239
+ ### Fallbacks & browser support for Clipboard API
240
+
241
+ Baseline status for the api.Clipboard.writeText capability: Widely available. It's been Baseline since 2020-03-24.
242
+ Supported by: Chrome 66 (Apr 2018), Edge 79 (Jan 2020), Firefox 63 (Oct 2018), Safari 13.1 (Mar 2020), and Safari iOS 13.4 (Mar 2020).
243
+
244
+ Where the Clipboard API is unavailable, `navigator.clipboard` is undefined and the call throws, so the `catch` branch in the feedback snippet reports the failure.
245
+
246
+ ### Fallbacks & browser support for Anchor positioning
247
+
248
+ Browser support for Anchor positioning: Limited availability.
249
+ Supported by: Chrome 157 (Nov 2026), Edge 157 (Nov 2026), and Safari 27 (Sep 2026).
250
+ Unsupported in: Firefox.
251
+
252
+ Without anchor positioning, a popover is placed by the UA at the center of the viewport. Tooltips need no fallback: the `title` upgrade above is skipped without anchor positioning. For the overflow menu, position it from script so it stays attached to its trigger. Keep the CSS inside `@supports not (position-area: block-end)` so supporting browsers are unaffected.
253
+
254
+ ```css
255
+ @supports not (position-area: block-end) {
256
+ #more-menu {
257
+ /* Viewport coordinates are set from script when the menu opens */
258
+ position: fixed;
259
+ inset: auto;
260
+ margin: 0;
261
+ }
262
+ }
263
+ ```
264
+
265
+ ```js
266
+ // Only needed without anchor positioning; place the menu below its trigger
267
+ // and flip above it when it would overflow the viewport.
268
+ menu.addEventListener("toggle", ({ newState }) => {
269
+ if (newState !== "open" || CSS.supports("position-area", "block-end")) return;
270
+ const t = more.getBoundingClientRect();
271
+ const m = menu.getBoundingClientRect();
272
+ const below = t.bottom + m.height <= innerHeight;
273
+ menu.style.top = `${below ? t.bottom : t.top - m.height}px`;
274
+ // Right-align with the trigger, clamped to the viewport
275
+ menu.style.left = `${Math.max(0, Math.min(t.right - m.width, innerWidth - m.width))}px`;
276
+ });
277
+ ```