a11y-elements 0.6.0 → 1.0.0

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 (288) hide show
  1. package/README.md +119 -73
  2. package/dist/a11y.css +28 -1
  3. package/dist/all.d.ts +1 -1
  4. package/dist/all.js.map +1 -1
  5. package/dist/browser/all.js +43 -43
  6. package/dist/browser/{chunk-UOOA4WYM.js → chunk-44L3YUQJ.js} +7 -6
  7. package/dist/browser/chunk-44L3YUQJ.js.map +1 -0
  8. package/dist/browser/{chunk-4KU26VOY.js → chunk-5RSHQHGV.js} +6 -2
  9. package/dist/browser/chunk-5RSHQHGV.js.map +1 -0
  10. package/dist/browser/{chunk-CKKI36NF.js → chunk-5YFWJMAQ.js} +14 -11
  11. package/dist/browser/chunk-5YFWJMAQ.js.map +1 -0
  12. package/dist/browser/{chunk-VZZ6PGGW.js → chunk-6IEDNGLL.js} +3 -3
  13. package/dist/browser/{chunk-XNWCI66X.js → chunk-7PDXC6SD.js} +52 -6
  14. package/dist/browser/chunk-7PDXC6SD.js.map +1 -0
  15. package/dist/browser/{chunk-WRM4HPFX.js → chunk-7QXDGULX.js} +30 -14
  16. package/dist/browser/chunk-7QXDGULX.js.map +1 -0
  17. package/dist/browser/{chunk-BRTWVAIT.js → chunk-APLB5CIR.js} +30 -6
  18. package/dist/browser/chunk-APLB5CIR.js.map +1 -0
  19. package/dist/browser/{chunk-34XMXDXI.js → chunk-CC6Q5ZYC.js} +3 -3
  20. package/dist/browser/{chunk-N7AMX7RC.js → chunk-CTZJDUT7.js} +35 -32
  21. package/dist/browser/chunk-CTZJDUT7.js.map +1 -0
  22. package/dist/browser/{chunk-5MZZUC7J.js → chunk-DF7YV5G6.js} +17 -16
  23. package/dist/browser/chunk-DF7YV5G6.js.map +1 -0
  24. package/dist/browser/{chunk-F4AVN6JZ.js → chunk-DRPQFOOG.js} +2 -2
  25. package/dist/browser/{chunk-IAXHGJ62.js → chunk-DSJKEIPD.js} +3 -3
  26. package/dist/browser/chunk-EDDGUTWP.js +147 -0
  27. package/dist/browser/chunk-EDDGUTWP.js.map +1 -0
  28. package/dist/browser/{chunk-5VP2UQ2M.js → chunk-EQB7LLIW.js} +10 -3
  29. package/dist/browser/chunk-EQB7LLIW.js.map +1 -0
  30. package/dist/browser/{chunk-4SU2MZLZ.js → chunk-EU7DRJE4.js} +35 -20
  31. package/dist/browser/chunk-EU7DRJE4.js.map +1 -0
  32. package/dist/browser/{chunk-5AG6BS4G.js → chunk-HWWZILDK.js} +18 -13
  33. package/dist/browser/chunk-HWWZILDK.js.map +1 -0
  34. package/dist/browser/{chunk-SGSOENNQ.js → chunk-JGSJG5EU.js} +11 -8
  35. package/dist/browser/chunk-JGSJG5EU.js.map +1 -0
  36. package/dist/browser/{chunk-7H2JJLCH.js → chunk-K67ZZOBF.js} +7 -5
  37. package/dist/browser/chunk-K67ZZOBF.js.map +1 -0
  38. package/dist/browser/{chunk-73Y3YTSE.js → chunk-KCPJBNAY.js} +15 -9
  39. package/dist/browser/chunk-KCPJBNAY.js.map +1 -0
  40. package/dist/browser/{chunk-SREYEWDY.js → chunk-KFG6RX7I.js} +3 -3
  41. package/dist/browser/{chunk-ZCMKKXSE.js → chunk-LJBKYSX6.js} +70 -27
  42. package/dist/browser/chunk-LJBKYSX6.js.map +1 -0
  43. package/dist/browser/{chunk-BIPMRVAZ.js → chunk-MAAAS7KK.js} +11 -14
  44. package/dist/browser/chunk-MAAAS7KK.js.map +1 -0
  45. package/dist/browser/chunk-MCZ5NL77.js +115 -0
  46. package/dist/browser/chunk-MCZ5NL77.js.map +1 -0
  47. package/dist/browser/{chunk-MENQDLBL.js → chunk-MDFG22D6.js} +17 -7
  48. package/dist/browser/chunk-MDFG22D6.js.map +1 -0
  49. package/dist/browser/{chunk-F47DDMFE.js → chunk-MNWKDM3I.js} +22 -2
  50. package/dist/browser/chunk-MNWKDM3I.js.map +1 -0
  51. package/dist/browser/{chunk-QT3RDF3H.js → chunk-MOCHOGCP.js} +6 -5
  52. package/dist/browser/chunk-MOCHOGCP.js.map +1 -0
  53. package/dist/browser/{chunk-ZLIFEZUJ.js → chunk-MY5QZOLS.js} +12 -7
  54. package/dist/browser/chunk-MY5QZOLS.js.map +1 -0
  55. package/dist/browser/{chunk-FFPWED5A.js → chunk-NAUZUS6P.js} +7 -6
  56. package/dist/browser/chunk-NAUZUS6P.js.map +1 -0
  57. package/dist/browser/{chunk-ACNPSWNA.js → chunk-NTKTYCDW.js} +6 -5
  58. package/dist/browser/chunk-NTKTYCDW.js.map +1 -0
  59. package/dist/browser/{chunk-2NVBEX7S.js → chunk-O57KZZ6M.js} +40 -12
  60. package/dist/browser/chunk-O57KZZ6M.js.map +1 -0
  61. package/dist/browser/{chunk-NEQKRAIP.js → chunk-PDDWEAQP.js} +4 -3
  62. package/dist/browser/chunk-PDDWEAQP.js.map +1 -0
  63. package/dist/browser/{chunk-6G3UL7FH.js → chunk-R66EFEQ3.js} +3 -3
  64. package/dist/browser/{chunk-MG2YZ7AD.js → chunk-UEEWMPZ5.js} +27 -7
  65. package/dist/browser/chunk-UEEWMPZ5.js.map +1 -0
  66. package/dist/browser/chunk-VEP2LUWY.js +65 -0
  67. package/dist/browser/chunk-VEP2LUWY.js.map +1 -0
  68. package/dist/browser/{chunk-LCRRFDV5.js → chunk-VWWLEAFY.js} +14 -8
  69. package/dist/browser/chunk-VWWLEAFY.js.map +1 -0
  70. package/dist/browser/{chunk-PTU2DM52.js → chunk-VYWCL2P2.js} +18 -9
  71. package/dist/browser/chunk-VYWCL2P2.js.map +1 -0
  72. package/dist/browser/{chunk-7NNZKO4M.js → chunk-W4ZI3OMR.js} +2 -2
  73. package/dist/browser/{chunk-SQ7OFQMX.js → chunk-WBIAPWRP.js} +3 -6
  74. package/dist/browser/chunk-WBIAPWRP.js.map +1 -0
  75. package/dist/browser/{chunk-67ZOQAXV.js → chunk-WLOXJS2P.js} +11 -7
  76. package/dist/browser/chunk-WLOXJS2P.js.map +1 -0
  77. package/dist/browser/{chunk-IL347KK3.js → chunk-WM7T7VI4.js} +53 -20
  78. package/dist/browser/chunk-WM7T7VI4.js.map +1 -0
  79. package/dist/browser/{chunk-PWR4UC47.js → chunk-YCZIATJ3.js} +47 -20
  80. package/dist/browser/chunk-YCZIATJ3.js.map +1 -0
  81. package/dist/browser/{chunk-EOB4TM57.js → chunk-YEEV4BVN.js} +12 -9
  82. package/dist/browser/chunk-YEEV4BVN.js.map +1 -0
  83. package/dist/browser/{chunk-2ZZTJUCP.js → chunk-ZYWLTQ77.js} +6 -5
  84. package/dist/browser/chunk-ZYWLTQ77.js.map +1 -0
  85. package/dist/browser/components/anchor/define.js +3 -3
  86. package/dist/browser/components/avatar/define.js +3 -3
  87. package/dist/browser/components/card-link/define.js +4 -4
  88. package/dist/browser/components/checkbox/define.js +3 -3
  89. package/dist/browser/components/checkbox-group/define.js +3 -3
  90. package/dist/browser/components/file-input/define.js +5 -5
  91. package/dist/browser/components/focusable/define.js +2 -2
  92. package/dist/browser/components/input/define.js +5 -5
  93. package/dist/browser/components/label/define.js +3 -3
  94. package/dist/browser/components/picture/define.js +3 -3
  95. package/dist/browser/components/progress/define.js +4 -3
  96. package/dist/browser/components/radio-group/define.js +3 -3
  97. package/dist/browser/components/select/define.js +3 -3
  98. package/dist/browser/components/skeleton/define.js +3 -3
  99. package/dist/browser/components/spinner/define.js +3 -3
  100. package/dist/browser/components/switch/define.js +3 -3
  101. package/dist/browser/components/tabs/define.js +4 -4
  102. package/dist/browser/components/textarea/define.js +5 -5
  103. package/dist/browser/components/visually-hidden/define.js +2 -2
  104. package/dist/browser/overlays/blocking-loader/define.js +7 -7
  105. package/dist/browser/overlays/context-menu/define.js +8 -8
  106. package/dist/browser/overlays/drawer/define.js +8 -7
  107. package/dist/browser/overlays/dropdown/define.js +9 -8
  108. package/dist/browser/overlays/emergency-dialog/define.js +8 -7
  109. package/dist/browser/overlays/floating/define.js +6 -5
  110. package/dist/browser/overlays/modal/define.js +9 -8
  111. package/dist/browser/overlays/notification-banner/define.js +5 -5
  112. package/dist/browser/overlays/popover/define.js +8 -7
  113. package/dist/browser/overlays/snackbar/define.js +5 -5
  114. package/dist/browser/overlays/tooltip/define.js +8 -7
  115. package/dist/components/anchor/anchor.element.d.ts +6 -2
  116. package/dist/components/anchor/anchor.element.js +37 -16
  117. package/dist/components/anchor/anchor.element.js.map +1 -1
  118. package/dist/components/card-link/card-link.element.js +2 -1
  119. package/dist/components/card-link/card-link.element.js.map +1 -1
  120. package/dist/components/checkbox/checkbox.element.d.ts +4 -1
  121. package/dist/components/checkbox/checkbox.element.js +11 -3
  122. package/dist/components/checkbox/checkbox.element.js.map +1 -1
  123. package/dist/components/checkbox-group/checkbox-group.element.d.ts +2 -1
  124. package/dist/components/checkbox-group/checkbox-group.element.js +19 -10
  125. package/dist/components/checkbox-group/checkbox-group.element.js.map +1 -1
  126. package/dist/components/file-input/file-input.element.js +13 -12
  127. package/dist/components/file-input/file-input.element.js.map +1 -1
  128. package/dist/components/focusable/focusable.element.js +5 -1
  129. package/dist/components/focusable/focusable.element.js.map +1 -1
  130. package/dist/components/label/label.element.js +2 -1
  131. package/dist/components/label/label.element.js.map +1 -1
  132. package/dist/components/picture/picture.element.js +12 -5
  133. package/dist/components/picture/picture.element.js.map +1 -1
  134. package/dist/components/progress/progress.element.d.ts +2 -0
  135. package/dist/components/progress/progress.element.js +10 -5
  136. package/dist/components/progress/progress.element.js.map +1 -1
  137. package/dist/components/radio-group/radio-group.element.d.ts +2 -1
  138. package/dist/components/radio-group/radio-group.element.js +9 -3
  139. package/dist/components/radio-group/radio-group.element.js.map +1 -1
  140. package/dist/components/select/select.element.d.ts +2 -1
  141. package/dist/components/select/select.element.js +3 -2
  142. package/dist/components/select/select.element.js.map +1 -1
  143. package/dist/components/switch/switch.element.d.ts +2 -1
  144. package/dist/components/switch/switch.element.js +3 -2
  145. package/dist/components/switch/switch.element.js.map +1 -1
  146. package/dist/components/tabs/tabs.element.d.ts +2 -0
  147. package/dist/components/tabs/tabs.element.js +13 -3
  148. package/dist/components/tabs/tabs.element.js.map +1 -1
  149. package/dist/core/a11y-element.d.ts +1 -0
  150. package/dist/core/a11y-element.js +5 -3
  151. package/dist/core/a11y-element.js.map +1 -1
  152. package/dist/core/a11y-field-element.d.ts +2 -1
  153. package/dist/core/a11y-field-element.js +3 -1
  154. package/dist/core/a11y-field-element.js.map +1 -1
  155. package/dist/core/a11y-overlay-element.js +10 -6
  156. package/dist/core/a11y-overlay-element.js.map +1 -1
  157. package/dist/core/dom.js +6 -4
  158. package/dist/core/dom.js.map +1 -1
  159. package/dist/core/field.js +5 -4
  160. package/dist/core/field.js.map +1 -1
  161. package/dist/core/focus-trap.d.ts +16 -2
  162. package/dist/core/focus-trap.js +95 -29
  163. package/dist/core/focus-trap.js.map +1 -1
  164. package/dist/core/ids.js +2 -1
  165. package/dist/core/ids.js.map +1 -1
  166. package/dist/core/index.d.ts +2 -1
  167. package/dist/core/index.js +2 -1
  168. package/dist/core/index.js.map +1 -1
  169. package/dist/core/overlay-registry.d.ts +31 -0
  170. package/dist/core/overlay-registry.js +114 -10
  171. package/dist/core/overlay-registry.js.map +1 -1
  172. package/dist/core/safe-dom.d.ts +35 -0
  173. package/dist/core/safe-dom.js +62 -0
  174. package/dist/core/safe-dom.js.map +1 -0
  175. package/dist/core/sanitize.d.ts +1 -7
  176. package/dist/core/sanitize.js +53 -14
  177. package/dist/core/sanitize.js.map +1 -1
  178. package/dist/core/strings.js +3 -2
  179. package/dist/core/strings.js.map +1 -1
  180. package/dist/core/template.d.ts +3 -1
  181. package/dist/core/template.js +5 -3
  182. package/dist/core/template.js.map +1 -1
  183. package/dist/core/transition.d.ts +8 -2
  184. package/dist/core/transition.js +34 -4
  185. package/dist/core/transition.js.map +1 -1
  186. package/dist/core/value-element.d.ts +18 -0
  187. package/dist/core/value-element.js +2 -0
  188. package/dist/core/value-element.js.map +1 -0
  189. package/dist/overlays/blocking-loader/blocking-loader.element.d.ts +1 -1
  190. package/dist/overlays/blocking-loader/blocking-loader.element.js +5 -11
  191. package/dist/overlays/blocking-loader/blocking-loader.element.js.map +1 -1
  192. package/dist/overlays/context-menu/context-menu.element.js +2 -1
  193. package/dist/overlays/context-menu/context-menu.element.js.map +1 -1
  194. package/dist/overlays/core/a11y-anchored-overlay-element.js +40 -17
  195. package/dist/overlays/core/a11y-anchored-overlay-element.js.map +1 -1
  196. package/dist/overlays/core/a11y-menu-overlay-element.d.ts +9 -0
  197. package/dist/overlays/core/a11y-menu-overlay-element.js +40 -9
  198. package/dist/overlays/core/a11y-menu-overlay-element.js.map +1 -1
  199. package/dist/overlays/core/a11y-modal-overlay-element.d.ts +6 -1
  200. package/dist/overlays/core/a11y-modal-overlay-element.js +57 -17
  201. package/dist/overlays/core/a11y-modal-overlay-element.js.map +1 -1
  202. package/dist/overlays/core/a11y-passive-overlay-element.d.ts +18 -1
  203. package/dist/overlays/core/a11y-passive-overlay-element.js +39 -2
  204. package/dist/overlays/core/a11y-passive-overlay-element.js.map +1 -1
  205. package/dist/overlays/drawer/drawer.element.d.ts +1 -0
  206. package/dist/overlays/drawer/drawer.element.js +9 -0
  207. package/dist/overlays/drawer/drawer.element.js.map +1 -1
  208. package/dist/overlays/dropdown/dropdown.element.d.ts +8 -0
  209. package/dist/overlays/dropdown/dropdown.element.js +24 -4
  210. package/dist/overlays/dropdown/dropdown.element.js.map +1 -1
  211. package/dist/overlays/emergency-dialog/emergency-dialog.element.d.ts +0 -2
  212. package/dist/overlays/emergency-dialog/emergency-dialog.element.js +0 -3
  213. package/dist/overlays/emergency-dialog/emergency-dialog.element.js.map +1 -1
  214. package/dist/overlays/floating/define.d.ts +2 -2
  215. package/dist/overlays/floating/define.js.map +1 -1
  216. package/dist/overlays/floating/floating.element.d.ts +4 -1
  217. package/dist/overlays/floating/floating.element.js +29 -28
  218. package/dist/overlays/floating/floating.element.js.map +1 -1
  219. package/dist/overlays/modal/confirm-dialog.js +7 -3
  220. package/dist/overlays/modal/confirm-dialog.js.map +1 -1
  221. package/dist/overlays/modal/modal.element.d.ts +1 -0
  222. package/dist/overlays/modal/modal.element.js +8 -0
  223. package/dist/overlays/modal/modal.element.js.map +1 -1
  224. package/dist/overlays/notification-banner/define.js +4 -3
  225. package/dist/overlays/notification-banner/define.js.map +1 -1
  226. package/dist/overlays/notification-banner/notification-banner.element.d.ts +4 -4
  227. package/dist/overlays/notification-banner/notification-banner.element.js +14 -8
  228. package/dist/overlays/notification-banner/notification-banner.element.js.map +1 -1
  229. package/dist/overlays/popover/popover.element.d.ts +7 -0
  230. package/dist/overlays/popover/popover.element.js +32 -1
  231. package/dist/overlays/popover/popover.element.js.map +1 -1
  232. package/dist/overlays/snackbar/define.js +4 -3
  233. package/dist/overlays/snackbar/define.js.map +1 -1
  234. package/dist/overlays/snackbar/snackbar.element.d.ts +18 -0
  235. package/dist/overlays/snackbar/snackbar.element.js +52 -6
  236. package/dist/overlays/snackbar/snackbar.element.js.map +1 -1
  237. package/dist/overlays/tooltip/tooltip.element.js +2 -2
  238. package/dist/overlays/tooltip/tooltip.element.js.map +1 -1
  239. package/package.json +4 -2
  240. package/dist/browser/chunk-2NVBEX7S.js.map +0 -1
  241. package/dist/browser/chunk-2ZZTJUCP.js.map +0 -1
  242. package/dist/browser/chunk-4KU26VOY.js.map +0 -1
  243. package/dist/browser/chunk-4SU2MZLZ.js.map +0 -1
  244. package/dist/browser/chunk-5AG6BS4G.js.map +0 -1
  245. package/dist/browser/chunk-5MZZUC7J.js.map +0 -1
  246. package/dist/browser/chunk-5VP2UQ2M.js.map +0 -1
  247. package/dist/browser/chunk-67ZOQAXV.js.map +0 -1
  248. package/dist/browser/chunk-73Y3YTSE.js.map +0 -1
  249. package/dist/browser/chunk-7H2JJLCH.js.map +0 -1
  250. package/dist/browser/chunk-ACNPSWNA.js.map +0 -1
  251. package/dist/browser/chunk-BIPMRVAZ.js.map +0 -1
  252. package/dist/browser/chunk-BRTWVAIT.js.map +0 -1
  253. package/dist/browser/chunk-C3FJNOYD.js +0 -73
  254. package/dist/browser/chunk-C3FJNOYD.js.map +0 -1
  255. package/dist/browser/chunk-CKKI36NF.js.map +0 -1
  256. package/dist/browser/chunk-EOB4TM57.js.map +0 -1
  257. package/dist/browser/chunk-F47DDMFE.js.map +0 -1
  258. package/dist/browser/chunk-FFPWED5A.js.map +0 -1
  259. package/dist/browser/chunk-IL347KK3.js.map +0 -1
  260. package/dist/browser/chunk-LCRRFDV5.js.map +0 -1
  261. package/dist/browser/chunk-MENBNSBN.js +0 -80
  262. package/dist/browser/chunk-MENBNSBN.js.map +0 -1
  263. package/dist/browser/chunk-MENQDLBL.js.map +0 -1
  264. package/dist/browser/chunk-MG2YZ7AD.js.map +0 -1
  265. package/dist/browser/chunk-N7AMX7RC.js.map +0 -1
  266. package/dist/browser/chunk-NEQKRAIP.js.map +0 -1
  267. package/dist/browser/chunk-PTU2DM52.js.map +0 -1
  268. package/dist/browser/chunk-PWR4UC47.js.map +0 -1
  269. package/dist/browser/chunk-QT3RDF3H.js.map +0 -1
  270. package/dist/browser/chunk-SGSOENNQ.js.map +0 -1
  271. package/dist/browser/chunk-SQ7OFQMX.js.map +0 -1
  272. package/dist/browser/chunk-UOOA4WYM.js.map +0 -1
  273. package/dist/browser/chunk-WQJUSHAX.js +0 -40
  274. package/dist/browser/chunk-WQJUSHAX.js.map +0 -1
  275. package/dist/browser/chunk-WRM4HPFX.js.map +0 -1
  276. package/dist/browser/chunk-XNWCI66X.js.map +0 -1
  277. package/dist/browser/chunk-ZCMKKXSE.js.map +0 -1
  278. package/dist/browser/chunk-ZLIFEZUJ.js.map +0 -1
  279. package/dist/core/a11y-form-element.d.ts +0 -23
  280. package/dist/core/a11y-form-element.js +0 -30
  281. package/dist/core/a11y-form-element.js.map +0 -1
  282. /package/dist/browser/{chunk-VZZ6PGGW.js.map → chunk-6IEDNGLL.js.map} +0 -0
  283. /package/dist/browser/{chunk-34XMXDXI.js.map → chunk-CC6Q5ZYC.js.map} +0 -0
  284. /package/dist/browser/{chunk-F4AVN6JZ.js.map → chunk-DRPQFOOG.js.map} +0 -0
  285. /package/dist/browser/{chunk-IAXHGJ62.js.map → chunk-DSJKEIPD.js.map} +0 -0
  286. /package/dist/browser/{chunk-SREYEWDY.js.map → chunk-KFG6RX7I.js.map} +0 -0
  287. /package/dist/browser/{chunk-6G3UL7FH.js.map → chunk-R66EFEQ3.js.map} +0 -0
  288. /package/dist/browser/{chunk-7NNZKO4M.js.map → chunk-W4ZI3OMR.js.map} +0 -0
package/README.md CHANGED
@@ -2,9 +2,60 @@
2
2
 
3
3
  Framework-agnostic accessibility Custom Elements (Web Components). A behavior layer, not a themed UI kit.
4
4
 
5
- Every element is Light DOM only (no Shadow DOM), so you always style real markup with your own CSS.
5
+ - See a [demo of the components](https://nutin.dev/a11y-elements/elements)
6
+ - See a [demo of the overlays](https://nutin.dev/a11y-elements/overlays)
6
7
 
7
- See a [demo of the elements](https://nutin.dev/a11y-elements/elements) - See a [demo of the overlays](https://nutin.org/a11y-elements/overlays)
8
+ ## Elements
9
+
10
+ ### Accessibility components
11
+
12
+ - [`<a11y-anchor>`](#a11y-anchor)
13
+ - [`<a11y-avatar>`](#a11y-avatar)
14
+ - [`<a11y-card-link>`](#a11y-card-link)
15
+ - [`<a11y-checkbox>`](#a11y-checkbox)
16
+ - [`<a11y-checkbox-group>`](#a11y-checkbox-group)
17
+ - [`<a11y-file-input>`](#a11y-file-input)
18
+ - [`<a11y-focusable>`](#a11y-focusable)
19
+ - [`<a11y-input>`](#a11y-input)
20
+ - [`<a11y-label>`](#a11y-label)
21
+ - [`<a11y-picture>`](#a11y-picture)
22
+ - [`<a11y-progress>`](#a11y-progress)
23
+ - [`<a11y-radio-group>`](#a11y-radio-group)
24
+ - [`<a11y-select>`](#a11y-select)
25
+ - [`<a11y-skeleton>`](#a11y-skeleton)
26
+ - [`<a11y-spinner>`](#a11y-spinner)
27
+ - [`<a11y-switch>`](#a11y-switch)
28
+ - [`<a11y-tabs>`](#a11y-tabs)
29
+ - [`<a11y-textarea>`](#a11y-textarea)
30
+ - [`<a11y-visually-hidden>`](#a11y-visually-hidden)
31
+
32
+ ### Overlays
33
+
34
+ Behavior shared by overlays is described once, in [Common to all overlays](#common-to-all-overlays).
35
+
36
+ - [`<a11y-blocking-loader>`](#a11y-blocking-loader)
37
+ - [`<a11y-context-menu>`](#a11y-context-menu)
38
+ - [`<a11y-drawer>`](#a11y-drawer)
39
+ - [`<a11y-dropdown>`](#a11y-dropdown)
40
+ - [`<a11y-emergency-dialog>`](#a11y-emergency-dialog)
41
+ - [`<a11y-floating>`](#a11y-floating)
42
+ - [`<a11y-modal>`](#a11y-modal)
43
+ - [`<a11y-notification-banner>`](#a11y-notification-banner)
44
+ - [`<a11y-popover>`](#a11y-popover)
45
+ - [`<a11y-snackbar>`](#a11y-snackbar)
46
+ - [`<a11y-tooltip>`](#a11y-toolti
47
+
48
+ ### Import paths
49
+
50
+ Import paths follow the folder names: `a11y-elements/components/<name>` or `a11y-elements/overlays/<name>` (add `/element` for the class), and `dist/browser/<group>/<name>/define.js` for zero-build.
51
+
52
+ ### Values
53
+
54
+ Elements that hold a value (checkbox, switch, select, radio-group, checkbox-group, input, textarea, file-input) share one contract, typed as `ValueElement<V>` in `a11y-elements/core`: `getValue()` reads it, `setValue(value)` writes it silently (no events, no `onChange`), and `onChange(value)` is called when the user changes it. The native controls inside stay the source of truth and the ones that submit.
55
+
56
+ ### CSS attributes
57
+
58
+ Attributes that set a CSS variable (spinner `size`/`color`/…, avatar `size`, skeleton `width`/`height`) win over your own inline value for that variable only while they're set. See [Scope to one instance](#scope-to-one-instance).
8
59
 
9
60
  ## Usage
10
61
 
@@ -70,7 +121,7 @@ setStrings({
70
121
  | `navigatedTo` | `Navigated to {name}` | `<a11y-anchor>` jump announcement (`{name}` is the target's name) | `navigated-label` |
71
122
  | `closeDialog` | `Close dialog` | the × button of `<a11y-modal>`, `<a11y-drawer>`, `<a11y-emergency-dialog>`, an expandable `<a11y-floating>`'s panel | `close-label` |
72
123
  | `confirm` / `cancel` | `OK` / `Cancel` | the buttons of `confirmDialog()` | `confirmLabel` / `cancelLabel` |
73
- | `dismiss` | `Dismiss` | the × button of each `<a11y-notification-banner>` item and of a `dismissible` `<a11y-floating>` | `dismiss-label` |
124
+ | `dismiss` | `Dismiss` | the × button of each `<a11y-notification-banner>` item, of each `<a11y-snackbar>` toast, and of a `dismissible` `<a11y-floating>` | `dismiss-label` |
74
125
  | `loading` | `Loading` | `<a11y-spinner>`, `<a11y-blocking-loader>` | `label` / `message` |
75
126
  | `progress` | `Progress` | `<a11y-progress>` without a label | `label` / `aria-label` |
76
127
  | `avatar` | `Avatar` | `<a11y-avatar>` with no `alt` or `initials` | `alt` / `initials` |
@@ -92,27 +143,13 @@ setStrings({
92
143
  * Elements already on the page update right away, so calling it again on a language switch is enough.
93
144
  * `resetStrings()` restores the English defaults.
94
145
 
95
- ## Elements
96
-
97
- Each section shows an example, the element's own attributes/properties/methods, and its CSS variables (collapsed).
98
-
99
- Behavior shared by overlays is described once, in [Common to all overlays](#common-to-all-overlays).
100
-
101
- **Accessibility components:** [`<a11y-anchor>`](#a11y-anchor) · [`<a11y-avatar>`](#a11y-avatar) · [`<a11y-card-link>`](#a11y-card-link) · [`<a11y-checkbox>`](#a11y-checkbox) · [`<a11y-checkbox-group>`](#a11y-checkbox-group) · [`<a11y-file-input>`](#a11y-file-input) · [`<a11y-focusable>`](#a11y-focusable) · [`<a11y-input>`](#a11y-input) · [`<a11y-label>`](#a11y-label) · [`<a11y-picture>`](#a11y-picture) · [`<a11y-progress>`](#a11y-progress) · [`<a11y-radio-group>`](#a11y-radio-group) · [`<a11y-select>`](#a11y-select) · [`<a11y-skeleton>`](#a11y-skeleton) · [`<a11y-spinner>`](#a11y-spinner) · [`<a11y-switch>`](#a11y-switch) · [`<a11y-tabs>`](#a11y-tabs) · [`<a11y-textarea>`](#a11y-textarea) · [`<a11y-visually-hidden>`](#a11y-visually-hidden)
146
+ ## Accessibility components
102
147
 
103
- **Overlays:** [`<a11y-blocking-loader>`](#a11y-blocking-loader) · [`<a11y-context-menu>`](#a11y-context-menu) · [`<a11y-drawer>`](#a11y-drawer) · [`<a11y-dropdown>`](#a11y-dropdown) · [`<a11y-emergency-dialog>`](#a11y-emergency-dialog) · [`<a11y-floating>`](#a11y-floating) · [`<a11y-modal>`](#a11y-modal) · [`<a11y-notification-banner>`](#a11y-notification-banner) · [`<a11y-popover>`](#a11y-popover) · [`<a11y-snackbar>`](#a11y-snackbar) · [`<a11y-tooltip>`](#a11y-tooltip)
104
-
105
- Import paths follow the folder names: `a11y-elements/components/<name>` or `a11y-elements/overlays/<name>` (add `/element` for the class), and `dist/browser/<group>/<name>/define.js` for zero-build.
106
-
107
- Attributes that set a CSS variable (spinner `size`/`color`/…, avatar `size`, skeleton `width`/`height`) win over your own inline value for that variable only while they're set. See [Scope to one instance](#scope-to-one-instance).
108
-
109
- ### Accessibility components
110
-
111
- #### `a11y-anchor`
148
+ ### `a11y-anchor`
112
149
 
113
150
  Enhances a real `<a href>`:
114
151
 
115
- * **Same-page links** (`href="#id"`) smooth-scroll to the target (instantly under `prefers-reduced-motion: reduce`), move focus to it, and announce the navigation to screen readers by the target's `aria-label`, `aria-labelledby` or heading, falling back to its `id`. The target is made focusable with `tabindex="-1"` while focused; a `tabindex` it already had is restored on blur. Space activates too.
152
+ * **Same-page links** (`href="#id"`) smooth-scroll to the target (instantly under `prefers-reduced-motion: reduce`), move focus to it, and announce the navigation to screen readers by the target's `aria-label`, `aria-labelledby` or heading, falling back to its `id`. The target is made focusable with `tabindex="-1"` while focused; a `tabindex` it already had is restored on blur. The fragment is still added to the URL and history (with `history.pushState()`, so no `hashchange` event and no `:target` update). A link whose target doesn't exist, or whose fragment is malformed, is left to the browser. Space activates too.
116
153
  * **New-tab links** (`target="_blank"` or a named target) get `rel="noopener noreferrer"` and "(opens in new tab)" appended to their accessible name.
117
154
 
118
155
  Both strings can be [translated](#translating-built-in-strings).
@@ -129,7 +166,7 @@ Both strings can be [translated](#translating-built-in-strings).
129
166
 
130
167
  No CSS variables of its own: style the `<a>` directly.
131
168
 
132
- #### `a11y-avatar`
169
+ ### `a11y-avatar`
133
170
 
134
171
  An avatar image with an initials fallback. When the image is missing or fails to load, the initials show instead and the element gets `role="img"` with an `aria-label`.
135
172
 
@@ -165,7 +202,7 @@ The initials are set in Arial rather than the page font, so they fit the circle
165
202
 
166
203
  </details>
167
204
 
168
- #### `a11y-card-link`
205
+ ### `a11y-card-link`
169
206
 
170
207
  Makes a whole card go to one page through a real `<a href>` inside it (usually around the title). The link stays the card's only tab stop and its accessible name, so screen readers announce a link named by the title, Enter follows it, Space scrolls the page, and middle-click, "Open in new tab" and "Copy link address" work on it.
171
208
 
@@ -203,7 +240,7 @@ The whole card is outlined while its link has keyboard focus (`:has(:focus-visib
203
240
 
204
241
  </details>
205
242
 
206
- #### `a11y-checkbox`
243
+ ### `a11y-checkbox`
207
244
 
208
245
  Wraps a real `<input type="checkbox">` in a `<label>` with a visible label text. The input stays yours: `name`, `checked`, `disabled`, `required` are plain HTML attributes on it.
209
246
 
@@ -253,7 +290,7 @@ checkbox.onChange = (checked) => console.log('accepted:', checked);
253
290
 
254
291
  </details>
255
292
 
256
- #### `a11y-checkbox-group`
293
+ ### `a11y-checkbox-group`
257
294
 
258
295
  Wraps your checkboxes in a `<fieldset>` with a `<legend>`, styled like `<a11y-checkbox>`. Add `select-all` for a "Select all" checkbox: it's checked when every option is, partly checked when some are, and checks or unchecks them all. It has no `name`, so it's never submitted, and disabled options keep their own state.
259
296
 
@@ -302,7 +339,7 @@ Options use the `--a11y-checkbox-*` variables above.
302
339
 
303
340
  </details>
304
341
 
305
- #### `a11y-file-input`
342
+ ### `a11y-file-input`
306
343
 
307
344
  A file picker built from a real `<input type="file">`, with the same parts as [`a11y-input`](#a11y-input). Files can be browsed for or dropped onto the element. It only picks files: the input keeps its `name` and submits them with the form, or you read `getValue()` and upload them yourself.
308
345
 
@@ -388,9 +425,9 @@ The hint and error use the [shared field variables](#a11y-input).
388
425
 
389
426
  </details>
390
427
 
391
- #### `a11y-focusable`
428
+ ### `a11y-focusable`
392
429
 
393
- Makes a non-button element behave like a button: `role="button"`, `tabindex="0"`, and Enter/Space fire a real `click`, so one `click` listener covers mouse and keyboard. Prefer a real `<button>` whenever you can.
430
+ Makes a non-button element behave like a button: `role="button"`, `tabindex="0"` (unless you set your own), and Enter/Space on the element itself fire a real `click`, so one `click` listener covers mouse and keyboard. Keys pressed in a control nested inside are left to that control, and nothing fires while `aria-disabled="true"`. Prefer a real `<button>` whenever you can.
394
431
 
395
432
  It's for **actions**. Cards that go to another page should use [`<a11y-card-link>`](#a11y-card-link) or a plain `<a href>`: a button role, Space activation and no `href` mislead screen-reader users and break "Open in new tab".
396
433
 
@@ -406,7 +443,7 @@ It's for **actions**. Cards that go to another page should use [`<a11y-card-link
406
443
 
407
444
  No CSS variables.
408
445
 
409
- #### `a11y-input`
446
+ ### `a11y-input`
410
447
 
411
448
  A text field built from a real `<input>` and optional parts, wired together for you:
412
449
 
@@ -539,7 +576,7 @@ Shared by the parts of every field:
539
576
 
540
577
  </details>
541
578
 
542
- ##### Building your own field: `bindField()`
579
+ #### Building your own field: `bindField()`
543
580
 
544
581
  The same wiring, without the custom elements: `bindField()` takes the control and its parts as any elements you like, for example from a framework component. It's exported from `a11y-elements/core`, and from the input and textarea `define.js` bundles.
545
582
 
@@ -563,7 +600,7 @@ field.destroy(); // on unmount: removes its listeners and the ARIA it added
563
600
 
564
601
  A real `<label>` is linked with `for`; any other element with `aria-labelledby`. Tokens you put in `aria-describedby` / `aria-labelledby` yourself are kept.
565
602
 
566
- #### `a11y-label`
603
+ ### `a11y-label`
567
604
 
568
605
  Renders a real `<label class="a11y-label">` around its content. A custom element can't itself be a `<label>`, and only a real one gives click-to-focus and native naming. Inside `<a11y-input>` / `<a11y-textarea>` it's linked automatically; on its own, `for` is forwarded:
569
606
 
@@ -595,7 +632,7 @@ A `*` marks a required field. It's CSS only and hidden from screen readers, whic
595
632
 
596
633
  </details>
597
634
 
598
- #### `a11y-picture`
635
+ ### `a11y-picture`
599
636
 
600
637
  Wraps a `<picture>`/`<img>` and optional `<figcaption>`, yours or generated from attributes, as `role="figure"`. An image with `alt=""` and no caption is treated as decorative and hidden from assistive tech (`aria-hidden="true"`).
601
638
 
@@ -664,7 +701,7 @@ The `PictureSource` and `PictureImage` types are exported with the element.
664
701
 
665
702
  </details>
666
703
 
667
- #### `a11y-progress`
704
+ ### `a11y-progress`
668
705
 
669
706
  A labelled progress bar around a native `<progress>`. Without `value`, it shows an indeterminate animation.
670
707
 
@@ -674,8 +711,8 @@ A labelled progress bar around a native `<progress>`. Without `value`, it shows
674
711
 
675
712
  | Name | Kind | Default | Description |
676
713
  | --- | --- | --- | --- |
677
- | `value` | attribute / property | — | Current value; absent means indeterminate. |
678
- | `max` | attribute / property | `100` | Maximum value. |
714
+ | `value` | attribute / property | — | Current value; absent, empty or not a number means indeterminate. |
715
+ | `max` | attribute / property | `100` | Maximum value; `100` unless it's a positive number. |
679
716
  | `label` | attribute | — | Visible label, used as the accessible name. |
680
717
  | `aria-label` | attribute | `Progress` | Accessible name when there's no visible `label`. The default can be [translated](#translating-built-in-strings). |
681
718
 
@@ -697,7 +734,7 @@ A labelled progress bar around a native `<progress>`. Without `value`, it shows
697
734
 
698
735
  </details>
699
736
 
700
- #### `a11y-radio-group`
737
+ ### `a11y-radio-group`
701
738
 
702
739
  Wraps your radios in a `<fieldset>` with a `<legend>`. Give every radio the same `name`; that's what makes them one native group.
703
740
 
@@ -745,7 +782,7 @@ Wraps your radios in a `<fieldset>` with a `<legend>`. Give every radio the same
745
782
 
746
783
  </details>
747
784
 
748
- #### `a11y-select`
785
+ ### `a11y-select`
749
786
 
750
787
  Wraps a real `<select>` in a `<label>` with a visible label text. Options and keyboard handling stay native.
751
788
 
@@ -795,7 +832,7 @@ The native `<select>` inside stays the source of truth: its `change` events and
795
832
 
796
833
  </details>
797
834
 
798
- #### `a11y-skeleton`
835
+ ### `a11y-skeleton`
799
836
 
800
837
  A loading placeholder, hidden from assistive tech.
801
838
 
@@ -833,7 +870,7 @@ A loading placeholder, hidden from assistive tech.
833
870
 
834
871
  </details>
835
872
 
836
- #### `a11y-spinner`
873
+ ### `a11y-spinner`
837
874
 
838
875
  A loading spinner with `role="status"`. No JS needed beyond the define.
839
876
 
@@ -871,7 +908,7 @@ Size presets: add `a11y-spinner--sm`, `a11y-spinner--lg` or `a11y-spinner--xl` t
871
908
 
872
909
  </details>
873
910
 
874
- #### `a11y-switch`
911
+ ### `a11y-switch`
875
912
 
876
913
  Like `<a11y-checkbox>`, but the input gets `role="switch"`.
877
914
 
@@ -916,7 +953,7 @@ Like `<a11y-checkbox>`, but the input gets `role="switch"`.
916
953
 
917
954
  </details>
918
955
 
919
- #### `a11y-tabs`
956
+ ### `a11y-tabs`
920
957
 
921
958
  Turns your own tab buttons and panels into the WAI-ARIA Tabs pattern (automatic activation). Tabs are the `[data-tab]` elements inside the `[data-tablist]` child, each one showing the `[data-panel]` with the same name.
922
959
 
@@ -971,7 +1008,7 @@ Turns your own tab buttons and panels into the WAI-ARIA Tabs pattern (automatic
971
1008
 
972
1009
  </details>
973
1010
 
974
- #### `a11y-textarea`
1011
+ ### `a11y-textarea`
975
1012
 
976
1013
  `<a11y-input>` for a real `<textarea>`: same parts, attributes, properties, validation and states.
977
1014
 
@@ -1000,7 +1037,7 @@ The same as [`a11y-input`](#a11y-input), prefixed `--a11y-textarea-` instead of
1000
1037
 
1001
1038
  </details>
1002
1039
 
1003
- #### `a11y-visually-hidden`
1040
+ ### `a11y-visually-hidden`
1004
1041
 
1005
1042
  Content for screen readers only, hidden visually.
1006
1043
 
@@ -1013,9 +1050,9 @@ Content for screen readers only, hidden visually.
1013
1050
 
1014
1051
  No attributes or CSS variables. The class `a11y-visually-hidden` is also usable on its own.
1015
1052
 
1016
- ### Overlays
1053
+ ## Overlays
1017
1054
 
1018
- #### Common to all overlays
1055
+ ### Common to all overlays
1019
1056
 
1020
1057
  * **Open/close** with the `open` attribute or property, or `show()` / `close()`.
1021
1058
  * **Before the element is defined** (lazy-loaded bundles), setting `.open = true`, `onClose` or any other property works: it's applied once the element upgrades. `setAttribute('open', '')` works too.
@@ -1038,11 +1075,11 @@ No attributes or CSS variables. The class `a11y-visually-hidden` is also usable
1038
1075
  * **Except `<a11y-floating>`**, which is visible by default and has no `open`: `dismissAllOverlays()` only collapses its expanded panel. See [`a11y-floating`](#a11y-floating).
1039
1076
  * **Body mounting:** every overlay (including the snackbar and notification-banner regions) moves itself to `<body>` when connected, so a `position: fixed` layer isn't clipped by an ancestor. See [Overlays in a framework](#overlays-in-a-framework) below.
1040
1077
 
1041
- ##### Overlays in a framework
1078
+ #### Overlays in a framework
1042
1079
 
1043
- ###### Removing them is up to you.
1080
+ ##### Removing them is up to you.
1044
1081
 
1045
- An overlay authored inside a component isn't inside that component's DOM any more, so when your framework removes the component's subtree (an unmount, a SPA navigation), the overlay stays in `<body>`, and the next render adds a second copy with the same `id`. Call `removeOverlaysWithin(host)` on unmount. It removes every overlay authored inside `host`, even after `host` has left the document, and returns how many it removed. It's exported from `a11y-elements/core` and from every overlay's `define.js`.
1082
+ An overlay authored inside a component isn't inside that component's DOM any more, so when your framework removes the component's subtree (an unmount, a SPA navigation), the overlay stays in `<body>`, and the next render adds a second copy with the same `id`. Call `removeOverlaysWithin(host)` on unmount. It removes every overlay authored inside `host`, and any overlay authored inside one of those (a tooltip in a modal), even after `host` has left the document, and returns how many it removed. It's exported from `a11y-elements/core` and from every overlay's `define.js`.
1046
1083
 
1047
1084
  ```js
1048
1085
  import { removeOverlaysWithin } from 'a11y-elements/core';
@@ -1053,7 +1090,7 @@ onUnmount(() => removeOverlaysWithin(hostElement)); // your framework's unmount
1053
1090
 
1054
1091
  Nothing is removed automatically, so subtrees your framework detaches and reattaches later (keep-alive caches, keyed moves) keep their overlays.
1055
1092
 
1056
- ##### Don't reach overlay content through the host.
1093
+ #### Don't reach overlay content through the host.
1057
1094
 
1058
1095
  If the overlay's bundle is already loaded, `host.innerHTML = '…<a11y-modal>…'` upgrades the overlay and moves it to `<body>` during that same assignment, so a later `host.querySelectorAll(...)` finds nothing inside it.
1059
1096
 
@@ -1065,18 +1102,21 @@ If the bundle loads after rendering, the same query does find it, so the result
1065
1102
  * bind events on the overlay element itself, or delegate from it;
1066
1103
  * put final text into the markup before injecting it, rather than in a pass after rendering.
1067
1104
 
1068
- ##### Bind overlay events yourself.
1105
+ #### Bind overlay events yourself.
1069
1106
 
1070
1107
  Framework template bindings (event directives, declarative listeners) usually run over the component's subtree after it's inserted. By then the overlay has already moved to `<body>`, so its bindings never attach. Get the overlay with `getElementById`, call `addEventListener` on it (or delegate from it) after each render, and remove the listener on unmount.
1071
1108
 
1072
1109
  <a id="dialogs"></a>
1073
1110
 
1074
- ##### Dialogs (`<a11y-modal>`, `<a11y-drawer>`, `<a11y-emergency-dialog>`)
1111
+ #### Dialogs (`<a11y-modal>`, `<a11y-drawer>`, `<a11y-emergency-dialog>`)
1075
1112
 
1076
1113
  They also share:
1077
1114
 
1078
1115
  * A focus trap (Tab stays inside, focus returns to the trigger on close) and a page scroll lock (`html.a11y-no-scroll`, `overflow: hidden`). If the page had a classic scrollbar, the lock also adds `html.a11y-no-scroll--gutter` (`scrollbar-gutter: stable`), so the page keeps its width while the scrollbar is gone.
1079
- * Escape, a click on the backdrop, or the × close button close it, unless it's `non-dismissible`.
1116
+ * While open, the rest of `<body>` is made `inert`, so keyboard and screen reader users can't reach the page behind it. Toast and banner regions (`<a11y-snackbar>`, `<a11y-notification-banner>`) are left out, so their messages are still announced. Elements that were already `inert` stay that way.
1117
+ * Tab also reaches controls inside other web components' open shadow roots. Closed shadow roots can't be seen into.
1118
+ * Escape, a click on the backdrop, or the × close button close it, unless it's `non-dismissible`. An Escape that something inside already handled (`preventDefault()`, e.g. a combobox closing its list, or a tooltip) doesn't close it.
1119
+ * `non-dismissible`, `dialog-label` (and `fullscreen` / `edge`) also apply when changed while it's open.
1080
1120
  * On open, focus moves to `initial-focus` if set, else to a descendant with `autofocus`, else to the first focusable element. That's the × close button when it's dismissible.
1081
1121
  * The dialog is named after its first heading (`aria-labelledby`), or `dialog-label`.
1082
1122
 
@@ -1091,7 +1131,7 @@ They also share:
1091
1131
 
1092
1132
  <a id="anchored-overlays"></a>
1093
1133
 
1094
- ##### Anchored overlays (`<a11y-popover>`, `<a11y-tooltip>`, `<a11y-dropdown>`, `<a11y-context-menu>`)
1134
+ #### Anchored overlays (`<a11y-popover>`, `<a11y-tooltip>`, `<a11y-dropdown>`, `<a11y-context-menu>`)
1095
1135
 
1096
1136
  They are positioned next to an anchor. They flip to the opposite side when there isn't room, and close on a click outside or Escape.
1097
1137
 
@@ -1105,9 +1145,9 @@ They are positioned next to an anchor. They flip to the opposite side when there
1105
1145
 
1106
1146
  <a id="menus"></a>
1107
1147
 
1108
- ##### Menus (`<a11y-dropdown>`, `<a11y-context-menu>`)
1148
+ #### Menus (`<a11y-dropdown>`, `<a11y-context-menu>`)
1109
1149
 
1110
- Items are your own children with `role="menuitem"`. Arrow keys, Home and End move between them, and Enter/Space fire a real `click`. The menu closes after an item is clicked or when focus leaves it. Mark an item `aria-disabled="true"` to skip it.
1150
+ Items are your own children with `role="menuitem"`. Arrow keys, Home and End move between them, and Enter/Space fire a real `click`. The menu closes after an item is clicked or when focus leaves it. Mark an item `aria-disabled="true"` (or, on a `<button>`, `disabled`) to skip it.
1111
1151
 
1112
1152
  <details>
1113
1153
  <summary>CSS variables shared by anchored overlays and menus</summary>
@@ -1124,7 +1164,7 @@ Items are your own children with `role="menuitem"`. Arrow keys, Home and End mov
1124
1164
 
1125
1165
  </details>
1126
1166
 
1127
- #### `a11y-blocking-loader`
1167
+ ### `a11y-blocking-loader`
1128
1168
 
1129
1169
  A full-screen loading overlay that can't be dismissed. While open, the rest of the page is `inert` and focus moves onto the loader; both are restored on close. Contains an `<a11y-spinner>` (registered automatically).
1130
1170
 
@@ -1158,7 +1198,7 @@ See [Common to all overlays](#common-to-all-overlays) for `open`, `show()` / `cl
1158
1198
 
1159
1199
  </details>
1160
1200
 
1161
- #### `a11y-context-menu`
1201
+ ### `a11y-context-menu`
1162
1202
 
1163
1203
  A menu that opens at the pointer on right-click of a trigger element, replacing the browser's own menu there. See [Menus](#menus) and [Anchored overlays](#anchored-overlays).
1164
1204
 
@@ -1194,7 +1234,7 @@ Also takes the shared [anchored-overlay](#anchored-overlays) options `placement`
1194
1234
 
1195
1235
  </details>
1196
1236
 
1197
- #### `a11y-drawer`
1237
+ ### `a11y-drawer`
1198
1238
 
1199
1239
  A panel that slides in from a screen edge. Behaves like `<a11y-modal>` (see [Dialogs](#dialogs)).
1200
1240
 
@@ -1231,7 +1271,7 @@ The close button uses the modal's `--a11y-modal-close-button-size` and `--a11y-m
1231
1271
 
1232
1272
  </details>
1233
1273
 
1234
- #### `a11y-dropdown`
1274
+ ### `a11y-dropdown`
1235
1275
 
1236
1276
  A menu attached to a trigger button. The anchor is the trigger: clicking it toggles the menu, and it gets `aria-haspopup`, `aria-controls` and `aria-expanded`. See [Anchored overlays](#anchored-overlays) and [Menus](#menus).
1237
1277
 
@@ -1262,7 +1302,7 @@ No attributes of its own. It takes the shared [anchored-overlay](#anchored-overl
1262
1302
 
1263
1303
  </details>
1264
1304
 
1265
- #### `a11y-emergency-dialog`
1305
+ ### `a11y-emergency-dialog`
1266
1306
 
1267
1307
  A modal the user can't dismiss: no close button, no Escape, no backdrop click, whatever its attributes say. For things that must be resolved on purpose, e.g. "your session is about to expire". Close it from code.
1268
1308
 
@@ -1293,7 +1333,7 @@ From the shared [dialog](#dialogs) options, only `dialog-label` and `onClose` ap
1293
1333
 
1294
1334
  </details>
1295
1335
 
1296
- #### `a11y-floating`
1336
+ ### `a11y-floating`
1297
1337
 
1298
1338
  Content pinned to a corner or edge of the viewport: a floating button that opens a drawer, an info bubble, a help launcher. It's visible by default: there's no `open` attribute. Hide it with `hidden` or `dismiss()`. Several in the same position stack instead of overlapping.
1299
1339
 
@@ -1337,7 +1377,7 @@ It works in one of two modes:
1337
1377
  | `scroll-threshold` | attribute | `16` | Pixels of scrolling before `hide-on-scroll` reacts. |
1338
1378
  | `dismiss()` | method | — | Fires a cancelable `a11y-floating-dismiss` event, then animates out and sets `hidden`. Focus goes back to where it was before it entered. |
1339
1379
  | `show()` | method | — | Shows it again (`hidden = false`). |
1340
- | `onClose` | callback | — | Called when the panel collapses or the element is dismissed. |
1380
+ | `onClose` | callback | — | Called with `'collapse'` when the panel collapses, and `'dismiss'` when the element is dismissed (both, in that order, when it's dismissed while expanded). |
1341
1381
 
1342
1382
  Events on the element: `a11y-floating-expand`, `a11y-floating-collapse`, `a11y-floating-dismiss` (cancelable). The panel also fires `a11y-overlay-open` / `a11y-overlay-close` on `document`, and `dismissAllOverlays()` collapses it but leaves the element showing. Like every overlay it moves itself out of where it was authored (into `.a11y-floating-stack[data-position]` on `<body>`); see [Overlays in a framework](#overlays-in-a-framework) for `removeOverlaysWithin()`. Being last in `<body>`, it comes last in the Tab order.
1343
1383
 
@@ -1376,7 +1416,7 @@ Offsets add the device's safe-area inset (`env(safe-area-inset-*)`). The stackin
1376
1416
 
1377
1417
  </details>
1378
1418
 
1379
- #### `a11y-modal`
1419
+ ### `a11y-modal`
1380
1420
 
1381
1421
  A centered dialog. Your content is its children. See [Dialogs](#dialogs).
1382
1422
 
@@ -1409,9 +1449,9 @@ Also takes the shared [dialog](#dialogs) options: `non-dismissible`, `dialog-lab
1409
1449
 
1410
1450
  `.a11y-modal-buttons` is an optional footer-row class for your own buttons. It lays them out in a row, and gives plain `<button>`s a default look (padding, font size, hover colors). Those styles have zero specificity (`:where()`), so any class on your buttons overrides them. They also sit in the `a11y-elements` cascade layer, so any CSS of yours that isn't in a layer wins. If your own styles are layered (Tailwind's `@layer utilities`, for example), declare the order first so yours win: `@layer a11y-elements, base, components, utilities;`. With `danger: true`, `confirmDialog()`'s confirm button uses `--a11y-color-danger` for its text and hover background.
1411
1451
 
1412
- ##### Confirmation dialogs: `confirmDialog()`
1452
+ #### Confirmation dialogs: `confirmDialog()`
1413
1453
 
1414
- `confirmDialog()` asks a yes/no question in a temporary modal, and resolves `true` only when the confirm button is pressed. Every other close (Cancel, Escape, the backdrop, ×, `dismissAllOverlays()`) resolves `false`. Focus starts on Cancel, so a stray Enter doesn't confirm. The modal is removed once closed.
1454
+ `confirmDialog()` asks a yes/no question in a temporary modal, and resolves `true` only when the confirm button is pressed. Every other close (Cancel, Escape, the backdrop, ×, `dismissAllOverlays()`) resolves `false`. Focus starts on Cancel, so a stray Enter doesn't confirm. The modal is removed once closed. It isn't authored inside any component, so `removeOverlaysWithin()` doesn't see it: on a SPA navigation, close it with `dismissAllOverlays()` (which resolves it `false`), or remove `a11y-modal.a11y-confirm` yourself.
1415
1455
 
1416
1456
  ```js
1417
1457
  import { confirmDialog } from 'a11y-elements/overlays/modal';
@@ -1470,7 +1510,7 @@ modal.open = true;
1470
1510
 
1471
1511
  </details>
1472
1512
 
1473
- #### `a11y-notification-banner`
1513
+ ### `a11y-notification-banner`
1474
1514
 
1475
1515
  Full-width banners that stay until the user dismisses them (or you call `dismissAll()`). Place one region in the page, or skip it and use `showNotificationBanner()`, which finds or creates one.
1476
1516
 
@@ -1528,7 +1568,7 @@ Colors come from the shared `--a11y-color-*` tokens (see [Shared tokens](#shared
1528
1568
 
1529
1569
  </details>
1530
1570
 
1531
- #### `a11y-popover`
1571
+ ### `a11y-popover`
1532
1572
 
1533
1573
  Content attached to an anchor, opened from code. With `interactive` it's a `role="dialog"` that traps focus; without it, a `role="region"`. See [Anchored overlays](#anchored-overlays).
1534
1574
 
@@ -1548,6 +1588,7 @@ document.getElementById('info-btn').addEventListener('click', () => {
1548
1588
  | Name | Kind | Default | Description |
1549
1589
  | --- | --- | --- | --- |
1550
1590
  | `interactive` | attribute | absent | `role="dialog"` and a focus trap. |
1591
+ | `label` | attribute | — | Accessible name (`aria-label`). Without it, it's named by its first heading, else by its anchor (`aria-labelledby`). |
1551
1592
  | `trap-focus` | attribute | follows `interactive` | Force the focus trap on (`trap-focus`) or off (`trap-focus="false"`). |
1552
1593
  | `onClose` | callback | — | Called once it has closed. |
1553
1594
 
@@ -1569,9 +1610,9 @@ Also takes the shared [anchored-overlay](#anchored-overlays) options: `anchor` /
1569
1610
 
1570
1611
  </details>
1571
1612
 
1572
- #### `a11y-snackbar`
1613
+ ### `a11y-snackbar`
1573
1614
 
1574
- Toast notifications that dismiss themselves: after 3 s by default, or 10 s when the toast has an action button. The countdown pauses while the toast is hovered or focused. Place one region in the page, or skip it and use `notify()`, which finds or creates one.
1615
+ Toast notifications that dismiss themselves: after 3 s by default, or 10 s when the toast has an action button. The countdown pauses while the toast is hovered or focused. A round × button in each toast's top-right corner dismisses it early (without running `onAction`). Place one region in the page, or skip it and use `notify()`, which finds or creates one.
1575
1616
 
1576
1617
  ```html
1577
1618
  <a11y-snackbar max-stack="5"></a11y-snackbar>
@@ -1590,13 +1631,15 @@ notify(h('span', null, 'Saved. ', h('a', { href: '/files' }, 'View files'))); //
1590
1631
 
1591
1632
  | Name | Kind | Default | Description |
1592
1633
  | --- | --- | --- | --- |
1634
+ | `dismiss-label` | attribute | `Dismiss` | Accessible name of each toast's × button. See [Translating built-in strings](#translating-built-in-strings). |
1593
1635
  | `max-stack` | attribute | `3` | How many toasts show at once; the rest wait in a queue and show as earlier ones are dismissed. |
1594
1636
  | `maxStack` | property | `3` | Same as `max-stack`. `setMaxStack(n)` is an alias. |
1595
1637
  | `notify(message, options)` | method | — | Shows a toast (or queues it). |
1638
+ | `dismissAll()` | method | — | Removes every showing toast and drops queued ones, without running `onAction`. |
1596
1639
 
1597
- It's a page region, not an open/close overlay: it fires no open/close events and `dismissAllOverlays()` leaves it alone. Like every overlay it moves itself to `<body>`; see [Overlays in a framework](#overlays-in-a-framework) for `removeOverlaysWithin()`.
1640
+ It's a page region, not an open/close overlay: it fires no open/close events and `dismissAllOverlays()` leaves it alone, so toasts outlive a SPA navigation while the region stays in the page. Call `dismissAll()` to clear them. Removing the region from the document (e.g. with `removeOverlaysWithin()`) drops its toasts, queued ones included, and cancels their timers; re-adding it starts empty. A toast enqueued while the region is detached waits until it's back in the page. Like every overlay it moves itself to `<body>`; see [Overlays in a framework](#overlays-in-a-framework) for `removeOverlaysWithin()`.
1598
1641
 
1599
- A `message` is text: a string is inserted as text, never parsed. A DOM node (e.g. built with `h()` from `a11y-elements/core`) is inserted as is. For markup, pass `raw(markup)` from `a11y-elements/core`. It's sanitized (no scripts, styles, event handlers or `javascript:` URLs), so it's safe with user data in it. `trustedRaw(markup)` skips that, for markup you wrote yourself. The same goes for `<a11y-notification-banner>`.
1642
+ A `message` is text: a string is inserted as text, never parsed. A DOM node (e.g. built with `h()` from `a11y-elements/core`) is inserted as is. For markup, pass `raw(markup)` from `a11y-elements/core`. It's sanitized against script injection (no scripts, `<style>`, event handlers or `javascript:` URLs). It also drops an `id` or `name` that would shadow a built-in of `document` or of a `<form>` (DOM clobbering: `name="createElement"`, `name="action"`, `id="body"`, …), or a name a form or image on the page already has. That's a basic XSS filter, not a full sanitizer like DOMPurify: forms, links, images and `style` attributes still pass, so untrusted markup can still look like your UI (phishing). Pass user data as text, or run it through DOMPurify first. `trustedRaw(markup)` skips that, for markup you wrote yourself. The same goes for `<a11y-notification-banner>`.
1600
1643
 
1601
1644
  `notify()` options (method and convenience export):
1602
1645
 
@@ -1604,7 +1647,7 @@ A `message` is text: a string is inserted as text, never parsed. A DOM node (e.g
1604
1647
  | --- | --- | --- |
1605
1648
  | `type` | `info` | `info`, `success`, `warning` or `error` (`error` uses `role="alert"`). |
1606
1649
  | `position` | `bottom` | `bottom` or `top`. |
1607
- | `duration` | `3000` (`10000` with an action) | Time on screen, in ms, not counting hover/focus. |
1650
+ | `duration` | `3000` (`10000` with an action) | Time on screen, in ms, not counting hover/focus. `Infinity` keeps the toast until it's dismissed. |
1608
1651
  | `actionText` / `onAction` | — | Adds an action button; clicking it dismisses the toast and runs `onAction`. |
1609
1652
  | `maxStack` | — | Sets `max-stack` on the region (sticky for later toasts). |
1610
1653
 
@@ -1619,6 +1662,9 @@ Colors come from the shared `--a11y-color-*` tokens (see [Shared tokens](#shared
1619
1662
  | --- | --- |
1620
1663
  | `--a11y-snackbar-animation-duration` | `0.3s` |
1621
1664
  | `--a11y-snackbar-border-radius` | `0.5rem` |
1665
+ | `--a11y-snackbar-close-border-width` | `2px` |
1666
+ | `--a11y-snackbar-close-font-size` | `1rem` |
1667
+ | `--a11y-snackbar-close-size` | `1.5rem` |
1622
1668
  | `--a11y-snackbar-container-width` | `350px` |
1623
1669
  | `--a11y-snackbar-gap` | `1rem` |
1624
1670
  | `--a11y-snackbar-offset` | `1rem` |
@@ -1630,7 +1676,7 @@ Colors come from the shared `--a11y-color-*` tokens (see [Shared tokens](#shared
1630
1676
 
1631
1677
  </details>
1632
1678
 
1633
- #### `a11y-tooltip`
1679
+ ### `a11y-tooltip`
1634
1680
 
1635
1681
  A short description shown on hover or focus of its anchor, which gets `aria-describedby`. It stays open while the pointer is over it, and Escape hides it. Never traps focus. See [Anchored overlays](#anchored-overlays).
1636
1682
 
@@ -1661,7 +1707,7 @@ Also takes the shared [anchored-overlay](#anchored-overlays) options: `anchor` /
1661
1707
 
1662
1708
  </details>
1663
1709
 
1664
- ### Shared tokens
1710
+ ## Shared tokens
1665
1711
 
1666
1712
  Status colors and the z-index scale, defined on `:root` (in `overlays/core/overlay-variables.css`). Override them globally, or override a component's own token instead.
1667
1713
 
package/dist/a11y.css CHANGED
@@ -1469,6 +1469,7 @@ a11y-floating.a11y-floating--scrolled-away {
1469
1469
  top: var(--a11y-snackbar-offset, 1rem);
1470
1470
  }
1471
1471
  .a11y-snackbar {
1472
+ position: relative;
1472
1473
  display: flex;
1473
1474
  justify-content: center;
1474
1475
  align-items: center;
@@ -1497,13 +1498,39 @@ a11y-floating.a11y-floating--scrolled-away {
1497
1498
  background: var(--a11y-color-warning, #f9a825);
1498
1499
  color: var(--a11y-color-text-on-warning, #111827);
1499
1500
  }
1500
- .a11y-snackbar button {
1501
+ .a11y-snackbar__action {
1501
1502
  background: transparent;
1502
1503
  border: none;
1503
1504
  color: inherit;
1504
1505
  font-weight: bold;
1505
1506
  cursor: pointer;
1506
1507
  }
1508
+ .a11y-snackbar__close {
1509
+ position: absolute;
1510
+ top: 0;
1511
+ right: 0;
1512
+ transform: translate(40%, -40%);
1513
+ display: flex;
1514
+ align-items: center;
1515
+ justify-content: center;
1516
+ box-sizing: border-box;
1517
+ width: var(--a11y-snackbar-close-size, 1.5rem);
1518
+ height: var(--a11y-snackbar-close-size, 1.5rem);
1519
+ padding: 0;
1520
+ border: var(--a11y-snackbar-close-border-width, 2px) solid currentColor;
1521
+ border-radius: 50%;
1522
+ background: inherit;
1523
+ color: inherit;
1524
+ font: inherit;
1525
+ font-size: var(--a11y-snackbar-close-font-size, 1rem);
1526
+ font-weight: bold;
1527
+ line-height: 1;
1528
+ cursor: pointer;
1529
+ }
1530
+ .a11y-snackbar__close:focus-visible {
1531
+ outline: 2px solid currentColor;
1532
+ outline-offset: 2px;
1533
+ }
1507
1534
  @keyframes a11y-snackbar-fade-in {
1508
1535
  from {
1509
1536
  opacity: 0;
package/dist/all.d.ts CHANGED
@@ -29,7 +29,7 @@ export { ContextMenuElement } from './overlays/context-menu/define.js';
29
29
  export { DrawerElement } from './overlays/drawer/define.js';
30
30
  export { DropdownElement } from './overlays/dropdown/define.js';
31
31
  export { EmergencyDialogElement } from './overlays/emergency-dialog/define.js';
32
- export { FloatingElement } from './overlays/floating/define.js';
32
+ export { FloatingElement, type FloatingCloseReason, type FloatingPosition } from './overlays/floating/define.js';
33
33
  export { ModalElement, confirmDialog, type ConfirmDialogOptions } from './overlays/modal/define.js';
34
34
  export { NotificationBannerElement, type NotificationBannerOptions, showNotificationBanner } from './overlays/notification-banner/define.js';
35
35
  export { PopoverElement } from './overlays/popover/define.js';
package/dist/all.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"all.js","sourceRoot":"","sources":["../src/all.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,aAAa,EAA6B,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAkC,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAC7I,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAsB,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"all.js","sourceRoot":"","sources":["../src/all.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAmD,MAAM,+BAA+B,CAAC;AACjH,OAAO,EAAE,YAAY,EAAE,aAAa,EAA6B,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAkC,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAC7I,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAsB,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}