@capagents/forgeqe 3.1.1 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/HOW_TO_USE.md +435 -78
  2. package/README.md +21 -6
  3. package/THIRD_PARTY_NOTICES.md +210 -1
  4. package/dist/docs-site/CREDITS.md +6 -0
  5. package/dist/docs-site/architecture-map/index.html +1 -1
  6. package/dist/docs-site/docs/app-theme.css +100 -8
  7. package/dist/docs-site/docs/architecture/index.html +210 -214
  8. package/dist/docs-site/docs/area-api/index.html +350 -0
  9. package/dist/docs-site/docs/area-automated-tests/index.html +967 -0
  10. package/dist/docs-site/docs/area-browser/index.html +430 -0
  11. package/dist/docs-site/docs/area-data/index.html +605 -0
  12. package/dist/docs-site/docs/area-desktop/index.html +755 -0
  13. package/dist/docs-site/docs/area-mobile/index.html +631 -0
  14. package/dist/docs-site/docs/area-operations/index.html +1069 -0
  15. package/dist/docs-site/docs/area-pull-requests/index.html +208 -0
  16. package/dist/docs-site/docs/area-quality/index.html +365 -0
  17. package/dist/docs-site/docs/area-release/index.html +320 -0
  18. package/dist/docs-site/docs/area-setup/index.html +1192 -0
  19. package/dist/docs-site/docs/area-systems/index.html +207 -0
  20. package/dist/docs-site/docs/area-test-cases/index.html +694 -0
  21. package/dist/docs-site/docs/containers/index.html +97 -104
  22. package/dist/docs-site/docs/cost-architecture/index.html +108 -112
  23. package/dist/docs-site/docs/custom-agents-first-run/index.html +19 -23
  24. package/dist/docs-site/docs/desktop/index.html +172 -162
  25. package/dist/docs-site/docs/desktop-ci/index.html +26 -33
  26. package/dist/docs-site/docs/evidence/index.html +253 -257
  27. package/dist/docs-site/docs/feature-test-prompts/index.html +66 -70
  28. package/dist/docs-site/docs/get-started/index.html +495 -0
  29. package/dist/docs-site/docs/graphify/index.html +42 -46
  30. package/dist/docs-site/docs/guardrails/index.html +17 -21
  31. package/dist/docs-site/docs/index.html +17 -6729
  32. package/dist/docs-site/docs/mobile/index.html +155 -162
  33. package/dist/docs-site/docs/model-routing/index.html +44 -51
  34. package/dist/docs-site/docs/overview/index.html +176 -0
  35. package/dist/docs-site/docs/product-graph/index.html +52 -55
  36. package/dist/docs-site/docs/product-knowledge/index.html +11 -15
  37. package/dist/docs-site/docs/product-views/index.html +53 -57
  38. package/dist/docs-site/docs/reference/index.html +379 -0
  39. package/dist/docs-site/docs/search.js +1 -1
  40. package/dist/docs-site/docs/using/index.html +480 -0
  41. package/dist/docs-site/docs/web-app/index.html +147 -93
  42. package/dist/docs-site/security/index.html +930 -0
  43. package/dist/docs-site/security/security-theme.css +161 -0
  44. package/dist/docs-site/security/security.js +1465 -0
  45. package/dist/docs-site/vendor/react-18.3.1.production.min.js +31 -0
  46. package/dist/docs-site/vendor/react-dom-18.3.1.production.min.js +267 -0
  47. package/dist/docs-site/vendor/reactflow-11.11.4.umd.js +10 -0
  48. package/dist/forgeqe.js +1902 -1895
  49. package/dist/web/THIRD_PARTY_NOTICES.md +0 -136
  50. package/dist/web/assets/Agent-CPhmZdFX.js +8 -0
  51. package/dist/web/assets/AgentWork-BXdN9xgi.js +2 -0
  52. package/dist/web/assets/ApiTests-Do3xLjfB.js +10 -0
  53. package/dist/web/assets/Browse-WVkJT6Bs.js +2 -0
  54. package/dist/web/assets/Chat-CDc9UcQX.js +3 -0
  55. package/dist/web/assets/CommandPalette-BAZm62lV.js +1 -0
  56. package/dist/web/assets/Compare-Br6n9T9L.js +1 -0
  57. package/dist/web/assets/Cost-BBUyBu3Y.js +1 -0
  58. package/dist/web/assets/Data-Ch2DPEWp.js +6 -0
  59. package/dist/web/assets/Desktop-Qzoq-cQv.js +1 -0
  60. package/dist/web/assets/DesktopReview-CF_jQYAM.js +1 -0
  61. package/dist/web/assets/Evidence-C72Lj5_Q.js +1 -0
  62. package/dist/web/assets/Explore-ObkEpUyS.js +2 -0
  63. package/dist/web/assets/Features-CQzNo_WP.js +1 -0
  64. package/dist/web/assets/Flags-0-RniPJm.js +2 -0
  65. package/dist/web/assets/Flaky-BPJvNLCA.js +1 -0
  66. package/dist/web/assets/Impact-CfccsL_k.js +3 -0
  67. package/dist/web/assets/Jobs-T6m4zhDy.js +5 -0
  68. package/dist/web/assets/KindPage-BDUvWe2p.js +6 -0
  69. package/dist/web/assets/Migration-Dqeh4x5u.js +2 -0
  70. package/dist/web/assets/PageAgent-DNjzIgeY.js +1 -0
  71. package/dist/web/assets/Product-nYV_scOV.js +7 -0
  72. package/dist/web/assets/Production-CGSbEWVa.js +1 -0
  73. package/dist/web/assets/Quality-BIypojZm.js +1 -0
  74. package/dist/web/assets/Readiness-BlRjwJRg.js +1 -0
  75. package/dist/web/assets/Record-v2KLI-_Z.js +1 -0
  76. package/dist/web/assets/Regression-B-jSt4Jz.js +5 -0
  77. package/dist/web/assets/RelationGraph-8J98lOVG.js +1 -0
  78. package/dist/web/assets/Reports-GI4u6SyW.js +2 -0
  79. package/dist/web/assets/Response-mhBThq2b.js +9 -0
  80. package/dist/web/assets/Responsive-DXu7Ra7K.js +3 -0
  81. package/dist/web/assets/RunDiff-D0SHDNp0.js +1 -0
  82. package/dist/web/assets/Runs-C1Gjdi9M.js +2 -0
  83. package/dist/web/assets/Settings-BGGeuvyF.js +21 -0
  84. package/dist/web/assets/Steps-D-YG0eJy.js +2 -0
  85. package/dist/web/assets/TestCases-DC4w77eQ.js +1 -0
  86. package/dist/web/assets/TestData-CvKWRVVV.js +2 -0
  87. package/dist/web/assets/TestDebt-D8YzN29_.js +1 -0
  88. package/dist/web/assets/TestManagement-C5cDCqrD.js +1 -0
  89. package/dist/web/assets/Tosca-BGUv3RiJ.js +3 -0
  90. package/dist/web/assets/WhatsNew-B_Gyuv8O.js +1 -0
  91. package/dist/web/assets/agents-C0Jg2pN8.js +1 -0
  92. package/dist/web/assets/coverage-BMP6ELFJ.js +5 -0
  93. package/dist/web/assets/dataParts-DbeCj9ga.js +3 -0
  94. package/dist/web/assets/diff-BStuTmsN.js +2 -0
  95. package/dist/web/assets/families-BBFFrUlo.js +1 -0
  96. package/dist/web/assets/filters-CnAMr286.js +1 -0
  97. package/dist/web/assets/fold-D_O_VZui.js +1 -0
  98. package/dist/web/assets/head-CRo48rPt.js +1 -0
  99. package/dist/web/assets/highlight-BcFZIf59.js +4 -0
  100. package/dist/web/assets/index-B3JsM7tv.js +64 -0
  101. package/dist/web/assets/index-CafApcbZ.css +2 -0
  102. package/dist/web/assets/input-CtzK50ZF.js +1 -0
  103. package/dist/web/assets/jsx-runtime-LKYXHABd.js +1 -0
  104. package/dist/web/assets/line-icons-rdF8DYDJ.js +1 -0
  105. package/dist/web/assets/logos-D4oVWzqa.js +1 -0
  106. package/dist/web/assets/palette-DAaGSao7.js +1 -0
  107. package/dist/web/assets/paletteCommands-Co-RlQ8q.js +1 -0
  108. package/dist/web/assets/parts-D357Wolo.js +1 -0
  109. package/dist/web/assets/productParts-B8oHRCJF.js +1 -0
  110. package/dist/web/assets/qualityParts-BLkmIfDY.js +1 -0
  111. package/dist/web/assets/recordTest-Cez2sDJO.js +1 -0
  112. package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  113. package/dist/web/assets/route-BloYJWgw.js +1 -0
  114. package/dist/web/index.html +12 -6
  115. package/docs/ARCHITECTURE.md +1 -1
  116. package/docs/BASAL.md +1 -1
  117. package/docs/DESKTOP.md +20 -1
  118. package/docs/EVIDENCE.md +1 -1
  119. package/docs/MOBILE.md +4 -4
  120. package/docs/PRODUCT_KNOWLEDGE.md +2 -0
  121. package/docs/WEB_APP.md +114 -51
  122. package/docs/user-guide.html +404 -81
  123. package/forgeqe.example.yaml +3 -3
  124. package/package.json +1 -1
  125. package/prompts/page-differs.md +1 -1
  126. package/prompts/requests-rule.md +1 -1
  127. package/prompts/test-reviewer.md +1 -1
  128. package/prompts/test-rules.md +3 -4
  129. package/skills/web-guidance/LICENSE +202 -0
  130. package/skills/web-guidance/SKILL.md +76 -0
  131. package/skills/web-guidance/UPSTREAM +67 -0
  132. package/skills/web-guidance/references/accessibility/accessibility.md +585 -0
  133. package/skills/web-guidance/references/accessibility/accessible-error-announcement.md +302 -0
  134. package/skills/web-guidance/references/accessibility/accessible-generated-content.md +41 -0
  135. package/skills/web-guidance/references/accessibility/respect-os-text-scale.md +127 -0
  136. package/skills/web-guidance/references/css/responsive-design.md +16 -0
  137. package/skills/web-guidance/references/forms/autofill-address-form.md +86 -0
  138. package/skills/web-guidance/references/forms/autofill-payment-form.md +142 -0
  139. package/skills/web-guidance/references/forms/autofill-sign-in-form.md +145 -0
  140. package/skills/web-guidance/references/forms/autofill-sign-up-form.md +155 -0
  141. package/skills/web-guidance/references/forms/forms.md +415 -0
  142. package/skills/web-guidance/references/forms/ime-safe-enter-submit.md +115 -0
  143. package/skills/web-guidance/references/forms/required-field-feedback.md +317 -0
  144. package/skills/web-guidance/references/forms/select-menu-interaction.md +310 -0
  145. package/skills/web-guidance/references/forms/slider.md +184 -0
  146. package/skills/web-guidance/references/forms/sms-otp-form.md +208 -0
  147. package/skills/web-guidance/references/forms/switch.md +60 -0
  148. package/skills/web-guidance/references/forms/validate-input-after-interaction.md +406 -0
  149. package/skills/web-guidance/references/performance/break-up-long-tasks.md +64 -0
  150. package/skills/web-guidance/references/performance/identify-heavy-scripts.md +69 -0
  151. package/skills/web-guidance/references/performance/identify-inp-causes.md +105 -0
  152. package/skills/web-guidance/references/performance/interaction-paint-timing.md +200 -0
  153. package/skills/web-guidance/references/performance/optimize-image-priority.md +73 -0
  154. package/skills/web-guidance/references/performance/performance.md +384 -0
  155. package/skills/web-guidance/references/privacy/privacy.md +247 -0
  156. package/skills/web-guidance/references/security/passkey-authentication.md +218 -0
  157. package/skills/web-guidance/references/security/passkey-management.md +310 -0
  158. package/skills/web-guidance/references/security/passkey-reauthentication.md +142 -0
  159. package/skills/web-guidance/references/security/passkey-registration.md +186 -0
  160. package/skills/web-guidance/references/security/passkeys.md +39 -0
  161. package/skills/web-guidance/references/security/sanitize-untrusted-html.md +105 -0
  162. package/skills/web-guidance/references/security/secure-external-subresources.md +202 -0
  163. package/skills/web-guidance/references/security/security.md +390 -0
  164. package/skills/web-guidance/references/security/trusted-types.md +141 -0
  165. package/skills/web-guidance/references/security/validate-origins.md +197 -0
  166. package/skills/web-guidance/references/security/verify-email-ownership.md +235 -0
  167. package/skills/web-guidance/references/ui-atoms/position-aware-tooltips.md +173 -0
  168. package/skills/web-guidance/references/ui-atoms/responsive-table.md +122 -0
  169. package/skills/web-guidance/references/ui-atoms/viewport-aware-dropdowns.md +178 -0
  170. package/skills/web-guidance/references/ui-behaviors/drag-and-drop.md +108 -0
  171. package/skills/web-guidance/references/ui-behaviors/light-dismiss-a-dialog.md +89 -0
  172. package/skills/web-guidance/references/ui-behaviors/motion.md +97 -0
  173. package/skills/web-guidance/references/ui-behaviors/platform-controls-dismiss-dialog.md +40 -0
  174. package/skills/web-guidance/references/ui-behaviors/prevent-page-scroll-under-modal-dialog.md +59 -0
  175. package/skills/web-guidance/references/ui-behaviors/search-hidden-content.md +141 -0
  176. package/skills/web-guidance/references/ui-behaviors/sortable-table.md +140 -0
  177. package/skills/web-guidance/references/ui-components/accordion.md +343 -0
  178. package/skills/web-guidance/references/ui-components/breadcrumbs.md +168 -0
  179. package/skills/web-guidance/references/ui-components/carousel.md +206 -0
  180. package/skills/web-guidance/references/ui-components/checkbox.md +144 -0
  181. package/skills/web-guidance/references/ui-components/dialog.md +218 -0
  182. package/skills/web-guidance/references/ui-components/hovercard.md +391 -0
  183. package/skills/web-guidance/references/ui-components/menu.md +415 -0
  184. package/skills/web-guidance/references/ui-components/navbar.md +281 -0
  185. package/skills/web-guidance/references/ui-components/navigation-drawer.md +429 -0
  186. package/skills/web-guidance/references/ui-components/persistent-toast-notifications.md +185 -0
  187. package/skills/web-guidance/references/ui-components/progress.md +181 -0
  188. package/skills/web-guidance/references/ui-components/spinner.md +179 -0
  189. package/skills/web-guidance/references/ui-components/tabs.md +371 -0
  190. package/skills/web-guidance/references/ui-components/toolbar.md +277 -0
  191. package/skills/web-guidance/references/user-experience/form-factor-adaptation.md +120 -0
  192. package/skills/web-guidance/references/user-experience/natural-interactions.md +155 -0
  193. package/skills/web-guidance/references/visual-design/color.md +43 -0
  194. package/skills/web-guidance/references/visual-design/dark-mode.md +350 -0
  195. package/dist/web/assets/AgentWork-DwAI0_Of.js +0 -2
  196. package/dist/web/assets/ApiTests-C0vFSHmM.js +0 -10
  197. package/dist/web/assets/Browse-5jfdtRc5.js +0 -2
  198. package/dist/web/assets/Chat-B3uhI94O.js +0 -3
  199. package/dist/web/assets/CommandPalette-D2J4nf5y.js +0 -1
  200. package/dist/web/assets/Compare-CN75w1p9.js +0 -1
  201. package/dist/web/assets/Cost-QoxyjR95.js +0 -1
  202. package/dist/web/assets/Data-BAvkcBVt.js +0 -6
  203. package/dist/web/assets/Desktop-BXdOIalN.js +0 -1
  204. package/dist/web/assets/DesktopReview-Bl2SrPP0.js +0 -1
  205. package/dist/web/assets/Evidence-BJ_I52CD.js +0 -1
  206. package/dist/web/assets/Explore-D9AuyTip.js +0 -2
  207. package/dist/web/assets/Features-CusGMDR9.js +0 -1
  208. package/dist/web/assets/Flags-CycGFuUP.js +0 -2
  209. package/dist/web/assets/Flaky-BcSzJogN.js +0 -1
  210. package/dist/web/assets/Impact-CJHnyZ21.js +0 -3
  211. package/dist/web/assets/Jobs-4xcFzEFo.js +0 -5
  212. package/dist/web/assets/KindPage-BielEIej.js +0 -6
  213. package/dist/web/assets/Migration-NwanKpJg.js +0 -2
  214. package/dist/web/assets/PageAgent-CNw4NXva.js +0 -1
  215. package/dist/web/assets/Product-DS3LJZ4P.js +0 -7
  216. package/dist/web/assets/Production-D3zsyNIS.js +0 -1
  217. package/dist/web/assets/Quality-Ctj2YpC4.js +0 -1
  218. package/dist/web/assets/Readiness-DGcRr_co.js +0 -1
  219. package/dist/web/assets/Record-Cc-wGe_Y.js +0 -1
  220. package/dist/web/assets/Regression-DcsbrRa1.js +0 -5
  221. package/dist/web/assets/Reports-BkCn0-Sf.js +0 -2
  222. package/dist/web/assets/Response-BP0UwQcW.js +0 -9
  223. package/dist/web/assets/Responsive-C8U7dumd.js +0 -3
  224. package/dist/web/assets/RunDiff-BhABuhF_.js +0 -1
  225. package/dist/web/assets/Runs-OwdWEYBv.js +0 -2
  226. package/dist/web/assets/Steps-BvzbQyoD.js +0 -2
  227. package/dist/web/assets/TestCases-CLq_6JA5.js +0 -1
  228. package/dist/web/assets/TestData-B0oKAhp6.js +0 -2
  229. package/dist/web/assets/TestDebt-8NLQ5YV_.js +0 -1
  230. package/dist/web/assets/TestManagement-2LYQ7vsN.js +0 -1
  231. package/dist/web/assets/Tosca-DfvMpPTG.js +0 -3
  232. package/dist/web/assets/WhatsNew-BGFNGwqN.js +0 -1
  233. package/dist/web/assets/families-DYlN5v0i.js +0 -1
  234. package/dist/web/assets/filters-faaSnoIq.js +0 -1
  235. package/dist/web/assets/fold-CUjwWAK3.js +0 -1
  236. package/dist/web/assets/frame-BLPdAXUq.js +0 -13
  237. package/dist/web/assets/head-CsTxBsO0.js +0 -1
  238. package/dist/web/assets/index-CxiCvGZq.js +0 -78
  239. package/dist/web/assets/index-dOIsrzhD.css +0 -2
  240. package/dist/web/assets/line-icons-CwZWt93L.js +0 -1
  241. package/dist/web/assets/logos-dGuc1jIM.js +0 -1
  242. package/dist/web/assets/markdown-BI3F-SJ1.js +0 -10
  243. package/dist/web/assets/paletteCommands-QJiCuUEr.js +0 -1
  244. package/dist/web/assets/parts-CdF1f7yS.js +0 -1
  245. package/dist/web/assets/productParts-hNLD9fN0.js +0 -1
  246. package/dist/web/assets/qualityParts-CT25lBWU.js +0 -1
  247. package/dist/web/assets/recordTest-P792aBUt.js +0 -1
@@ -0,0 +1,302 @@
1
+ # Accessible Error Announcement
2
+
3
+ ## The Problem
4
+ Standard HTML5 validation provides visual feedback (via `:invalid` or `:user-invalid`), but it doesn't automatically synchronize with accessibility attributes like `aria-invalid`.
5
+
6
+ If you use standard `:invalid` styling, screen readers might announce "Invalid entry" the moment a user tabs into a required field that is currently empty. This creates a disruptive experience for users using assistive technologies, as the error is announced before interaction has occurred.
7
+
8
+ ## The Solution
9
+ We want the *programmatic* state (`aria-invalid="true"`) to be applied **at the exact same moment** the *visual* state (`:user-invalid`) applies. Since `:user-invalid` relies on the browser's internal "user-interacted" flag, we can use JavaScript to check that this selector matches during standard interaction events.
10
+
11
+ Set `aria-invalid="false"` until `:user-invalid` matches, rather than leaving the attribute unset. Firefox and Safari expose an empty `required` field as invalid from page load, so an unset attribute still causes the premature "invalid entry" announcement there.
12
+
13
+ ### Implementation Strategy
14
+
15
+ 1. **Visual Layer**: Use CSS `:user-invalid` to show borders/icons.
16
+ 2. **Accessibility Layer**: Use `aria-invalid`, and list the error message in `aria-describedby` while the field is invalid, to communicate state to Assistive Technology (AT). Announce an error that appears when the user leaves a field through one polite live region for the page.
17
+ 3. **Bridge Visual & Accessibility Layer**: Create a lightweight JavaScript utility that listens for `blur`, `change`, `input` and `invalid` events, checks if the element matches `:user-invalid`, and updates the ARIA attributes accordingly.
18
+ 4. **Focus on Submit**: Screen readers announce a field's error when focus reaches the field, so after a failed submit, move focus to the first invalid field, or to an error summary (a heading followed by a link to each invalid field) on a long form. Native validation moves focus to the first invalid field for you; if the form uses `novalidate`, move it in your submit handler.
19
+
20
+ ## Implementation Guide
21
+
22
+ ### 1. HTML Structure
23
+ Link your input to its error message by setting the input's `data-error` attribute to the error message's `id`. The script in section 3 lists that `id` in `aria-describedby` only while the field is invalid. Don't reference the error from `aria-describedby` in the markup: the error element is always in the page, and text that `aria-describedby` references is announced even when it's hidden, so the error would be read out before the user has interacted.
24
+
25
+ ```html
26
+ <form>
27
+ <div class="field">
28
+ <label for="email">Email</label>
29
+ <input
30
+ type="email"
31
+ id="email"
32
+ required
33
+ data-error="email-error"
34
+ >
35
+ <span id="email-error" class="error-msg">
36
+ Please enter a valid email address.
37
+ </span>
38
+ </div>
39
+ </form>
40
+ ```
41
+
42
+ ### 2. CSS
43
+ Control the visibility of the error message using the native pseudo-class `:user-invalid`.
44
+
45
+ ```css
46
+ .error-msg {
47
+ display: none;
48
+ color: #d93025;
49
+ }
50
+
51
+ /* Show error message when input is user-invalid */
52
+ input:user-invalid ~ .error-msg {
53
+ display: block;
54
+ }
55
+
56
+ /* Optional: Visual cues on the input itself */
57
+ input:user-invalid {
58
+ border-color: #d93025;
59
+ }
60
+ ```
61
+
62
+ ### 3. JavaScript
63
+ Since there is no "UserInvalidChanged" event, hook into standard form events to check the state.
64
+
65
+ Native `:user-invalid` does not automatically sync with ARIA attributes. Add the following JavaScript to keep `aria-invalid` in sync with the visual state:
66
+
67
+ * Set `aria-invalid="false"` until `:user-invalid` matches, rather than leaving it unset. Firefox and Safari expose an empty `required` field as invalid from page load, and Chromium doesn't expose an empty `required` field as invalid after interaction unless `aria-invalid="true"` is set.
68
+ * Link each field to its error message by setting the field's `data-error` attribute to the error message's `id` (`data-error="email-error"` for `<div id="email-error">`), and let the script list that `id` in `aria-describedby` only while the field is invalid. Don't reference the error from `aria-describedby` in the markup: the error element is always in the page, and text that `aria-describedby` references is announced even when it's hidden.
69
+ * Announce an error that appears when the user leaves or changes a field through one polite live region for the page, a moment later so it doesn't talk over the next field. Don't make each error message a live region: a live region that is shown, rather than changed, isn't announced reliably. After a failed submit, move focus to the first invalid field so that its error is announced instead.
70
+
71
+ ```javascript
72
+ // List the field's error message (the id in data-error) in aria-describedby only while
73
+ // it's shown: text that aria-describedby references is announced even when it's hidden.
74
+ const linkError = (el, shown) => {
75
+ const errorId = el.dataset.error;
76
+ if (!errorId) return;
77
+ const ids = (el.getAttribute('aria-describedby') || '').split(/\s+/).filter((id) => id && id !== errorId);
78
+ if (shown) ids.push(errorId);
79
+ if (ids.length) el.setAttribute('aria-describedby', ids.join(' '));
80
+ else el.removeAttribute('aria-describedby');
81
+ };
82
+
83
+ // One polite live region for the page announces an error that appears when the user
84
+ // leaves or changes a field. Run this once the form is in the page.
85
+ const announcer = document.createElement('div');
86
+ announcer.setAttribute('aria-live', 'polite');
87
+ announcer.classList.add('visually-hidden');
88
+ document.body.append(announcer);
89
+ let announceTimer;
90
+ let announcedField;
91
+
92
+ // Text as a screen reader reads it: icons' text alternatives in, aria-hidden text out.
93
+ const spokenText = (node) => {
94
+ const copy = node.cloneNode(true);
95
+ copy.querySelectorAll('[aria-hidden="true"]').forEach((n) => n.remove());
96
+ copy.querySelectorAll('[role="img"][aria-label]').forEach((n) => n.replaceWith(`${n.getAttribute('aria-label')}: `));
97
+ return copy.textContent.replace(/\s+/g, ' ').trim();
98
+ };
99
+ const announceError = (el) => {
100
+ const error = document.getElementById(el.dataset.error);
101
+ if (!error) return;
102
+ const label = el.labels?.[0] ? `${spokenText(el.labels[0])}: ` : '';
103
+ clearTimeout(announceTimer);
104
+ announcer.textContent = '';
105
+ announcedField = el;
106
+ // Wait until the screen reader has announced the field that receives focus next.
107
+ announceTimer = setTimeout(() => { announcer.textContent = label + spokenText(error); }, 500);
108
+ };
109
+
110
+ // Sync aria-invalid with the CSS :user-invalid state. Only form fields are synced, and
111
+ // an aria-invalid="true" that this script didn't set (for example from a server check)
112
+ // is left alone.
113
+ const flagged = new WeakSet();
114
+ // Fields whose current error has been announced, or read out by focus after a failed
115
+ // submit. A field can become invalid while the user types, so this is tracked separately.
116
+ const announced = new WeakSet();
117
+ const syncAria = (el, announce = false) => {
118
+ if (!el.matches?.('input, select, textarea')) return;
119
+ const invalid = el.matches(':user-invalid');
120
+ if (invalid) {
121
+ if (announce && !announced.has(el)) {
122
+ announceError(el);
123
+ announced.add(el);
124
+ }
125
+ el.setAttribute('aria-invalid', 'true');
126
+ linkError(el, true);
127
+ flagged.add(el);
128
+ } else if (flagged.has(el) || el.getAttribute('aria-invalid') !== 'true') {
129
+ el.setAttribute('aria-invalid', 'false');
130
+ linkError(el, false);
131
+ flagged.delete(el);
132
+ announced.delete(el);
133
+ // Clear a fixed field's announcement so it isn't found later when reading the page.
134
+ if (announcedField === el) {
135
+ clearTimeout(announceTimer);
136
+ announcer.textContent = '';
137
+ }
138
+ }
139
+ };
140
+
141
+ // Start every field at aria-invalid="false".
142
+ document.querySelectorAll('input, select, textarea').forEach((el) => syncAria(el));
143
+
144
+ // Update on blur (to show and announce an error) and input (to clear it)
145
+ document.addEventListener('blur', (e) => syncAria(e.target, true), true);
146
+ document.addEventListener('input', (e) => {
147
+ if (e.target.hasAttribute('aria-invalid')) syncAria(e.target);
148
+ });
149
+
150
+ // Checkboxes, radio buttons and other controls that commit on 'change' can become
151
+ // :user-invalid without losing focus, so update on change too.
152
+ document.addEventListener('change', (e) => syncAria(e.target, true), true);
153
+
154
+ // A failed submit fires 'invalid' on each failing field, including required fields the
155
+ // user never touched, so update those too. 'invalid' doesn't bubble. Focus moving to the
156
+ // first invalid field announces its error, so these aren't announced.
157
+ document.addEventListener('invalid', (e) => {
158
+ announced.add(e.target);
159
+ syncAria(e.target);
160
+ }, true);
161
+
162
+ // Reset clears :user-invalid after the 'reset' event, so update each field afterwards.
163
+ document.addEventListener('reset', (e) => {
164
+ setTimeout(() => [...e.target.elements].forEach((el) => syncAria(el)));
165
+ }, true);
166
+ ```
167
+
168
+ Hide the live region with the `.visually-hidden` utility:
169
+
170
+ ```css
171
+ /* Hides content visually but keeps it in the accessibility tree */
172
+ .visually-hidden:where(:not(:focus-within, :active)) {
173
+ position: absolute !important;
174
+ clip-path: inset(50%) !important;
175
+ overflow: hidden !important;
176
+ width: 1px !important;
177
+ height: 1px !important;
178
+ margin: -1px !important;
179
+ padding: 0 !important;
180
+ border: 0 !important;
181
+ white-space: nowrap !important;
182
+ }
183
+ ```
184
+
185
+ ## Fallbacking & Browser Support
186
+
187
+ ### Fallbacks & browser support for :user-valid and :user-invalid
188
+
189
+ Baseline status for :user-valid and :user-invalid: Widely available. It's been Baseline since 2023-11-02.
190
+ Supported by: Chrome 119 (Oct 2023), Edge 119 (Nov 2023), Firefox 88 (Apr 2021), and Safari 16.5 (May 2023).
191
+
192
+ ### CSS for Fallback
193
+
194
+ ```css
195
+ /* Applies to every field that can be invalid (input, select, textarea). :is() keeps the
196
+ rule working where :user-invalid isn't supported: in a plain selector list, one
197
+ unsupported selector drops the whole rule. */
198
+ :is(:user-invalid, .user-invalid-fallback) {
199
+ border-color: #d93025;
200
+ background-color: #fce8e6;
201
+ }
202
+
203
+ :is(:user-invalid, .user-invalid-fallback) + .error-msg {
204
+ display: block;
205
+ }
206
+ ```
207
+
208
+ ### JavaScript Fallback
209
+
210
+ Use a reusable utility that tracks interaction state using a `WeakMap`. This avoids polluting the DOM with "dirty" classes or data attributes.
211
+
212
+ ```javascript
213
+ const UserInvalidFallback = (() => {
214
+ const dirtyState = new WeakMap();
215
+
216
+ const updateState = (input) => {
217
+ // validity.valid gives the current state without firing an 'invalid' event, as checkValidity() does.
218
+ const isValid = input.validity.valid;
219
+
220
+ // Update both visual and ARIA state
221
+ input.classList.toggle('user-invalid-fallback', !isValid);
222
+ input.classList.toggle('user-valid-fallback', isValid);
223
+
224
+ input.setAttribute('aria-invalid', isValid ? 'false' : 'true');
225
+ linkError(input, !isValid);
226
+ };
227
+
228
+ // List the error message (the id in data-error) in aria-describedby only while it's
229
+ // shown: text that aria-describedby references is announced even when it's hidden.
230
+ const linkError = (input, shown) => {
231
+ const errorId = input.dataset.error;
232
+ if (!errorId) return;
233
+ const ids = (input.getAttribute('aria-describedby') || '').split(/\s+/).filter((id) => id && id !== errorId);
234
+ if (shown) ids.push(errorId);
235
+ if (ids.length) input.setAttribute('aria-describedby', ids.join(' '));
236
+ else input.removeAttribute('aria-describedby');
237
+ };
238
+
239
+ const handleEvent = (event) => {
240
+ const input = event.target;
241
+
242
+ if (event.type === 'reset') {
243
+ const controls = input.elements || [];
244
+ for (const control of controls) {
245
+ dirtyState.delete(control);
246
+ control.classList.remove('user-invalid-fallback');
247
+ control.classList.remove('user-valid-fallback');
248
+ if (control.matches('input, select, textarea')) control.setAttribute('aria-invalid', 'false');
249
+ if (control.dataset?.error) linkError(control, false);
250
+ }
251
+ return;
252
+ }
253
+
254
+ if (!input.checkValidity) return;
255
+
256
+ // A submit attempt counts as interaction: the browser fires 'invalid' on each failing
257
+ // field, including required fields the user never touched, so flag them all.
258
+ if (event.type === 'invalid') {
259
+ dirtyState.set(input, { hasInteracted: true, hasBlurred: true });
260
+ updateState(input);
261
+ return;
262
+ }
263
+
264
+ if (event.type === 'input' || event.type === 'change') {
265
+ const state = dirtyState.get(input) || { hasInteracted: false, hasBlurred: false };
266
+ state.hasInteracted = true;
267
+ dirtyState.set(input, state);
268
+ if (state.hasBlurred) {
269
+ updateState(input);
270
+ }
271
+ } else if (event.type === 'blur') {
272
+ const state = dirtyState.get(input) || { hasInteracted: false, hasBlurred: false };
273
+ state.hasBlurred = true;
274
+ dirtyState.set(input, state);
275
+ if (state.hasInteracted) {
276
+ updateState(input);
277
+ }
278
+ }
279
+ };
280
+
281
+ const init = (root = document) => {
282
+ if (CSS.supports('selector(:user-invalid)')) return;
283
+
284
+ // Firefox and Safari expose an empty required field as invalid from page load.
285
+ root.querySelectorAll('input, select, textarea').forEach((el) => {
286
+ if (!el.hasAttribute('aria-invalid')) el.setAttribute('aria-invalid', 'false');
287
+ });
288
+
289
+ root.addEventListener('blur', handleEvent, true); // Capture phase
290
+ root.addEventListener('input', handleEvent);
291
+ root.addEventListener('change', handleEvent);
292
+ root.addEventListener('invalid', handleEvent, true); // invalid doesn't bubble
293
+ root.addEventListener('reset', handleEvent, true); // Capture resets
294
+ };
295
+
296
+ return { init };
297
+ })();
298
+
299
+ // Initialize for a specific form
300
+ const form = document.querySelector('#demo-form');
301
+ UserInvalidFallback.init(form);
302
+ ```
@@ -0,0 +1,41 @@
1
+ # Accessible generated content
2
+
3
+ - **DON'T** use `content` to convey meaningful text (labels, state, instructions) — keep that in the DOM (WCAG F87). The alt text argument is harm reduction for cases where decoration accidentally carries meaning, not a license.
4
+ - Use the alternative text argument of `content` to provide alt text for screen readers. E.g. `content: url(cloud.svg) / "Save";`
5
+ - Use `content: "text" / "";` to prevent purely decorative text from being announced to screen readers.
6
+ - **DON'T** use an empty alt text argument for images — they're already presentational by default. E.g. this is wrong: `content: url(cloud.svg) / "";`.
7
+ - **DON'T** use the alt text argument to describe emojis unless the description differs from the official emoji name. E.g. don't do `content: "🎉" / "celebration";`, but `content: "🎉" / "Yay!";` is fine.
8
+
9
+ **ONLY** use the alt text argument when the text is different than the primary value and is not already present in the DOM. I.e. this is wrong:
10
+
11
+ HTML:
12
+ ```html
13
+ <button class="save">Save</button>
14
+ ```
15
+
16
+ CSS:
17
+ ```css
18
+ button.save::before {
19
+ content: url(cloud.svg) / "Save";
20
+ }
21
+ ```
22
+
23
+ A screen reader would read it out as "Save save".
24
+
25
+ ## Fallback strategies
26
+
27
+ Baseline status for Alt text for generated content: Newly available. It's been Baseline since 2024-07-09.
28
+ Supported by: Chrome 77 (Sep 2019), Edge 79 (Jan 2020), Firefox 128 (Jul 2024), and Safari 17.4 (Mar 2024).
29
+
30
+ If your Baseline target includes browsers that do not support the `/` alternative text syntax, precede the declaration with a single-value `content` fallback so unsupported browsers do not drop the entire declaration as invalid CSS:
31
+
32
+ ```css
33
+ .more-link::after {
34
+ /* Fallback: render the glyph in browsers without `/` support
35
+ (screen readers there will still announce it) */
36
+ content: " →";
37
+ content: " →" / "";
38
+ }
39
+ ```
40
+
41
+ For non-empty alternative text (`content: url(...) / "..."`), a single-value `content: url(...)` fallback keeps the image visible in older browsers but drops its alt text. If that label is required in older browsers, put it in the DOM instead (e.g., via a visually hidden `<span>` or `aria-label`) and use a plain `content: url(...)` declaration without `/`.
@@ -0,0 +1,127 @@
1
+ # Respect Operating System Text Scale
2
+
3
+ ## Overview
4
+
5
+ Users with visual impairments often configure text scaling at the operating system level (such as Dynamic Type on iOS or Font Size scaling on Android/ChromeOS). By default, mobile browsers ignore these OS-level accessibility settings to prevent legacy, fixed-pixel websites from breaking visually.
6
+
7
+ Instead of keeping your page static or relying on custom, fragile JavaScript layout calculations, opt into native operating system text scaling using the `<meta name="text-scale">` tag. When active, the browser dynamically scales the root font size (`1rem`) to match the user's OS preference, allowing all relative (`rem`/`em`) font sizes, layouts, and spacing to scale automatically and gracefully.
8
+
9
+ ## Implementation
10
+
11
+ ### 1. Opt Into OS Text Scaling
12
+
13
+ Place the `<meta name="text-scale">` element inside your document's `<head>`. This signals to supporting browsers that your layout is modern, adaptive, and safe to scale:
14
+
15
+ ```html
16
+ <head>
17
+ <meta charset="UTF-8" />
18
+ <meta name="viewport" content="width=device-width" />
19
+
20
+ <!-- Opt this page into OS-level dynamic type and accessibility text scaling -->
21
+ <meta name="text-scale" content="scale" />
22
+
23
+ <title>Adaptive Accessibility Layout</title>
24
+ </head>
25
+ ```
26
+
27
+ ### 2. Use Relative Typography & Spacing
28
+
29
+ Define font sizes using relative units (`rem` or `em`) rather than fixed pixels (`px`). Use unitless values for line heights so they scale proportionally with each element's computed font size.
30
+
31
+ Use relative units for margins and padding where the spacing is coupled to text size or must adapt as text is scaled. Spacing that is independent of text may use fixed units when appropriate, provided that scaling does not cause text clipping, overlap, loss of content, or an unusable layout:
32
+
33
+ ```css
34
+ body {
35
+ font-family: system-ui, sans-serif;
36
+ /* Inherits the root font-size, which scales automatically with the OS setting */
37
+ line-height: 1.5; /* Unitless so it scales proportionally with computed font-size */
38
+ padding: 1.5rem; /* Scales proportionally to prevent dense crowding at larger scales */
39
+ }
40
+
41
+ h1 {
42
+ font-size: 2.25rem; /* Scales proportionally to the root base */
43
+ margin-bottom: 1rem;
44
+ }
45
+ ```
46
+
47
+ Set the base text size on `body` only when the design needs a size different from the inherited browser default; otherwise, let it inherit. Set sizes on specific elements, such as headings, with relative units such as `rem` or `em`. Use `rem` for a size relative to the root font size, and `em` when the size should depend on the parent element's font size. Do not set a custom font size on `:root` or `html`.
48
+
49
+ #### Fluid Typography
50
+
51
+ Fluid typography MAY use viewport-relative units such as `vw`, provided that font sizes also include a font-relative component such as `rem` or `em`. For more fluid-scaling techniques, including container query units and `clamp()`, see `fluid-scaling`.
52
+
53
+ Avoid sizing text exclusively with viewport units:
54
+
55
+ ```css
56
+ /* ❌ DO NOT DO THIS: The font size does not respond fully to user text scaling */
57
+ .heading {
58
+ font-size: 5vw;
59
+ }
60
+ ```
61
+
62
+ Instead, combine a font-relative value with viewport-relative scaling and use relative minimum and maximum bounds:
63
+
64
+ ```css
65
+ .heading {
66
+ font-size: clamp(2rem, 1.25rem + 2vw, 4rem);
67
+ }
68
+ ```
69
+
70
+ Test that text can be resized to at least 200% of its default size without loss of content or functionality. For fluid typography, a useful rule of thumb is to keep the maximum font size no more than 2.5 times the minimum. Also test reflow at a 320 CSS-pixel viewport width (equivalent to 400% zoom from a 1280 CSS-pixel-wide viewport); content MUST remain available without two-dimensional scrolling, except where essential.
71
+
72
+ ### 3. Use Scalable Responsive Breakpoints
73
+
74
+ Responsive breakpoints MUST NOT assume that text will remain at its default size. Where a breakpoint is intended to respond to available space for text, prefer content-driven layouts, container queries, or `em`-based media queries rather than fixed pixel thresholds.
75
+
76
+ Test responsive layouts with operating system text scaling and browser zoom enabled. Text MUST remain readable and content MUST remain visible without overlap, clipping, or horizontal scrolling.
77
+
78
+ ### 4. Ensure Content Wrapping & Flexible Heights
79
+
80
+ When text scales up, elements require more vertical and horizontal space to prevent truncation or overlap. To keep your components robust, design your layouts to expand dynamically around the content rather than forcing rigid coordinates:
81
+
82
+ * **Allow Text Containers to Grow**: Text-containing components and containers MUST be able to grow to accommodate scaled text. Avoid fixed `height` or `block-size` values and restrictive `max-height` or `max-block-size` values that can cause clipping or overflow. Prefer content-driven sizing; use `min-height` or `min-block-size` only when a minimum size is needed.
83
+ * **Allow Natural Wrapping**: Do not restrict inline-axis text wrapping with `white-space: nowrap` on blocks that contain sentences. Let text reflow to new lines naturally.
84
+ * **Employ Flexible Flexbox & Grid wrapping (Optional Example)**: For multi-column card galleries, use reflowing columns like `repeat(auto-fit, minmax(min(100%, 16rem), 1fr))` so items stack vertically if their relative width thresholds are crossed:
85
+
86
+ ```css
87
+ /* Card container using min-height to ensure expansion and auto-fit to reflow if needed */
88
+ .card {
89
+ padding: 1.5rem;
90
+ border: 1px solid #ccc;
91
+ border-radius: 8px;
92
+ /* Use min-height so the box expands vertically when the font is enlarged */
93
+ min-height: 10rem;
94
+ }
95
+ ```
96
+
97
+ ### 5. DO NOT Override the Root Font Size
98
+
99
+ When opting in via the `<meta name="text-scale" content="scale">` element, **DO NOT** explicitly set the root `font-size` in your stylesheet. This includes declarations on either `:root` or `html`, and applies to absolute units, relative units, and calculated values.
100
+
101
+ For example, do not override the root font size with a fixed value:
102
+
103
+ ```css
104
+ /* ❌ DO NOT DO THIS: This can prevent the browser from applying text scaling */
105
+ html {
106
+ font-size: 16px;
107
+ }
108
+ ```
109
+
110
+ Do not combine the `<meta name="text-scale" content="scale">` opt-in with `env(preferred-text-scale)` to apply operating system text scaling manually. The browser applies the scale through the meta opt-in, so using both can result in double-scaling:
111
+
112
+ ```css
113
+ /* ❌ DO NOT DO THIS: The meta opt-in already applies the operating system text scale */
114
+ :root {
115
+ font-size: calc(1rem * env(preferred-text-scale));
116
+ }
117
+ ```
118
+
119
+ Leave the root font size to the browser. The browser handles the operating system text scale automatically and applies it to content sized relative to the root font size.
120
+
121
+ ## Fallback Strategies
122
+
123
+ Browser support for <meta name="text-scale">: Limited availability.
124
+ Supported by: Chrome 146 (Mar 2026) and Edge 146 (Mar 2026).
125
+ Unsupported in: Firefox and Safari.
126
+
127
+ On browsers where `<meta name="text-scale" content="scale">` is unsupported, the layout degrades gracefully. The page will display the layout at the browser's standard default base font size (typically 16px), and the user can still utilize standard manual page zoom or pinch-to-zoom options.
@@ -0,0 +1,16 @@
1
+ # Responsive design
2
+
3
+ ## Overall best practices
4
+
5
+ - Use `@container` queries to create component-driven responsive layouts that adapt to their parent container's size rather than the viewport. See `size-aware-styling` for more details.
6
+ - Use dynamic viewport units (`dvh`, `dvw`) instead of `vh`/`vw` to prevent layout breakage when mobile browser UI elements (like address bars) appear or disappear.
7
+ - Use `aspect-ratio` for media elements (like `<img>` and `<video>`) to reserve space during loading and prevent Cumulative Layout Shift (CLS).
8
+
9
+ For the layout mechanics behind responsive UI (flexbox, grid, container query units, viewport units), see `css-layout`.
10
+
11
+ ## Responsive typography
12
+
13
+ - **DO** combine viewport-relative and font-relative units in `clamp()` for font sizes that scale with the viewport size while ensuring they stay within a desired range. For example, `clamp(2rem, 1rem + 5vw, 4rem)`. Adjust the proportion of viewport-relative and font-relative units to control how quickly the font-size changes. Use font-relative minimum and maximum values, and keep the maximum no more than 2.5 times the minimum. Viewport units don't grow when users zoom, so the text only grows once its minimum overtakes the viewport-based value; with a maximum no more than 2.5 times the minimum, browser zoom, which goes up to 500%, can still resize the text to 200% (WCAG 1.4.4 Resize Text requires text to resize up to 200% without loss of content or functionality).
14
+ - **DON'T** use `vw` alone for font-size without `clamp()`, as it can scale text too small or too large on extreme screens.
15
+
16
+ To scale type and spacing with the container instead of the viewport, see `fluid-scaling`.
@@ -0,0 +1,86 @@
1
+ # Build an address form that follows best practice
2
+
3
+ Create a form that makes it as easy as possible for users to enter address data on desktop and mobile. Ensure the form makes the most of built-in browser features for autofill, validation and data entry constraints.
4
+
5
+ ## How to implement
6
+
7
+ Outlined below are the most important guidelines for building successful address forms.
8
+
9
+ ### Use meaningful, valid HTML
10
+
11
+ Make the most of the elements and attributes built for creating forms:
12
+
13
+ - `<form>`, `<input>`, `<label>`, and `<button>`
14
+ - `type`, `autocomplete`, and `inputmode`
15
+
16
+ These enable built-in browser functionality, improve accessibility, and add meaning to markup.
17
+
18
+ ### Use the `<label>` element to label form fields for data entry
19
+
20
+ To label an `<input>`, `<select>`, or `<textarea>`, use a `<label>`. Associate a label with an input by giving the label's `for` attribute the same value as the input's `id`.
21
+
22
+ ### Make the most of HTML attributes
23
+
24
+ Make it easy for users to enter data, by using the appropriate `<input>` element with a `type` attribute to provide the right keyboard on mobile and enable basic built-in validation by the browser.
25
+
26
+ Always use `type="email"` for email addresses and `type="tel"` for phone numbers.
27
+
28
+ ```html
29
+ <!-- type="email"/"tel" gives mobile users the right keyboard and enables built-in validation -->
30
+ <input type="email" id="email" name="email" autocomplete="email" required>
31
+ <input type="tel" id="phone" name="phone" autocomplete="tel">
32
+ ```
33
+
34
+ Every `<input>`, `<select>`, and `<textarea>` element SHOULD have an appropriate `autocomplete` attribute, to improve accessibility and help users avoid re-entering data.
35
+
36
+ ### Make buttons helpful
37
+
38
+ Use `<button>` for buttons. You can also use `<input type="submit">`, but don't use a `div` or some other random element acting as a button. Button elements provide accessible behaviour, built-in form submission functionality, and can easily be styled.
39
+
40
+ Give each form submit button a value that says what it does. For each step towards checkout, use a descriptive call-to-action that shows progress and makes the next step obvious. For example, label the submit button on your delivery address form **Proceed to Payment** rather than **Continue** or **Save**.
41
+
42
+ ### Use a single name input where possible
43
+
44
+ Allow your users to enter their name using a single input, unless you have a good reason for separately storing given names, family names, honorifics, or other name parts. Using a single name input makes forms less complex, enables cut-and-paste, and makes autofill simpler. Use `autocomplete="name"` for a single input for name.
45
+
46
+ ```html
47
+ <input type="text" id="fullname" name="fullname" autocomplete="name">
48
+ ```
49
+
50
+ Allow international names. For validation, avoid using regular expressions that only match Latin characters. Latin-only excludes users with names or addresses that include characters that aren't in the Latin alphabet. Allow Unicode letter matching instead—and ensure your backend supports Unicode securely as both input and output. Unicode in regular expressions is well supported by modern browsers.
51
+
52
+ ### Allow for a variety of address formats
53
+
54
+ When building an address form, be aware of the variety of address formats, even within a single country. Do not make assumptions about "normal" addresses.
55
+
56
+ Use a single `<textarea>` element for the street address if possible.
57
+
58
+ ```html
59
+ <!-- textarea handles multi-line international address formats that split inputs can't accommodate -->
60
+ <textarea id="address" name="address" autocomplete="street-address" required></textarea>
61
+ ```
62
+
63
+ This is the most flexible option for a variety of local and international address formats.
64
+
65
+ If your data model needs separate address lines, use one `<input>` per line with the `address-line1`, `address-line2` (and, if needed, `address-line3`) `autocomplete` tokens so that autofill still works. Don't split the street address across inputs that lack these tokens, and make only the first line required.
66
+
67
+ ```html
68
+ <!-- Alternative: one input per line, each with its own autocomplete token -->
69
+ <input type="text" id="address-line1" name="address-line1" autocomplete="address-line1" required>
70
+ <input type="text" id="address-line2" name="address-line2" autocomplete="address-line2">
71
+ ```
72
+
73
+ ### Help save users from accidentally missing data fields
74
+
75
+ Add the `required` attribute to mandatory fields.
76
+
77
+ ```html
78
+ <input type="text" id="city" name="city" autocomplete="address-level2" required>
79
+ ```
80
+
81
+ ### Fallback strategies
82
+
83
+ Baseline status for the html.elements.input.autocomplete capability: Widely available. It's been Baseline since 2015-07-29.
84
+ Supported by: Chrome 14 (Sep 2011), Edge 12 (Jul 2015), Firefox 4 (Mar 2011), and Safari 6 (Jul 2012).
85
+
86
+ Autofill is a progressive enhancement. In browsers that do not support autofill, users will simply need to manually enter their address details. The semantic HTML constraints (such as `type`, `inputmode`, and `required`) will still function appropriately as standard form validation.