@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.
- package/HOW_TO_USE.md +435 -78
- package/README.md +21 -6
- package/THIRD_PARTY_NOTICES.md +210 -1
- package/dist/docs-site/CREDITS.md +6 -0
- package/dist/docs-site/architecture-map/index.html +1 -1
- package/dist/docs-site/docs/app-theme.css +100 -8
- package/dist/docs-site/docs/architecture/index.html +210 -214
- package/dist/docs-site/docs/area-api/index.html +350 -0
- package/dist/docs-site/docs/area-automated-tests/index.html +967 -0
- package/dist/docs-site/docs/area-browser/index.html +430 -0
- package/dist/docs-site/docs/area-data/index.html +605 -0
- package/dist/docs-site/docs/area-desktop/index.html +755 -0
- package/dist/docs-site/docs/area-mobile/index.html +631 -0
- package/dist/docs-site/docs/area-operations/index.html +1069 -0
- package/dist/docs-site/docs/area-pull-requests/index.html +208 -0
- package/dist/docs-site/docs/area-quality/index.html +365 -0
- package/dist/docs-site/docs/area-release/index.html +320 -0
- package/dist/docs-site/docs/area-setup/index.html +1192 -0
- package/dist/docs-site/docs/area-systems/index.html +207 -0
- package/dist/docs-site/docs/area-test-cases/index.html +694 -0
- package/dist/docs-site/docs/containers/index.html +97 -104
- package/dist/docs-site/docs/cost-architecture/index.html +108 -112
- package/dist/docs-site/docs/custom-agents-first-run/index.html +19 -23
- package/dist/docs-site/docs/desktop/index.html +172 -162
- package/dist/docs-site/docs/desktop-ci/index.html +26 -33
- package/dist/docs-site/docs/evidence/index.html +253 -257
- package/dist/docs-site/docs/feature-test-prompts/index.html +66 -70
- package/dist/docs-site/docs/get-started/index.html +495 -0
- package/dist/docs-site/docs/graphify/index.html +42 -46
- package/dist/docs-site/docs/guardrails/index.html +17 -21
- package/dist/docs-site/docs/index.html +17 -6729
- package/dist/docs-site/docs/mobile/index.html +155 -162
- package/dist/docs-site/docs/model-routing/index.html +44 -51
- package/dist/docs-site/docs/overview/index.html +176 -0
- package/dist/docs-site/docs/product-graph/index.html +52 -55
- package/dist/docs-site/docs/product-knowledge/index.html +11 -15
- package/dist/docs-site/docs/product-views/index.html +53 -57
- package/dist/docs-site/docs/reference/index.html +379 -0
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/using/index.html +480 -0
- package/dist/docs-site/docs/web-app/index.html +147 -93
- package/dist/docs-site/security/index.html +930 -0
- package/dist/docs-site/security/security-theme.css +161 -0
- package/dist/docs-site/security/security.js +1465 -0
- package/dist/docs-site/vendor/react-18.3.1.production.min.js +31 -0
- package/dist/docs-site/vendor/react-dom-18.3.1.production.min.js +267 -0
- package/dist/docs-site/vendor/reactflow-11.11.4.umd.js +10 -0
- package/dist/forgeqe.js +1902 -1895
- package/dist/web/THIRD_PARTY_NOTICES.md +0 -136
- package/dist/web/assets/Agent-CPhmZdFX.js +8 -0
- package/dist/web/assets/AgentWork-BXdN9xgi.js +2 -0
- package/dist/web/assets/ApiTests-Do3xLjfB.js +10 -0
- package/dist/web/assets/Browse-WVkJT6Bs.js +2 -0
- package/dist/web/assets/Chat-CDc9UcQX.js +3 -0
- package/dist/web/assets/CommandPalette-BAZm62lV.js +1 -0
- package/dist/web/assets/Compare-Br6n9T9L.js +1 -0
- package/dist/web/assets/Cost-BBUyBu3Y.js +1 -0
- package/dist/web/assets/Data-Ch2DPEWp.js +6 -0
- package/dist/web/assets/Desktop-Qzoq-cQv.js +1 -0
- package/dist/web/assets/DesktopReview-CF_jQYAM.js +1 -0
- package/dist/web/assets/Evidence-C72Lj5_Q.js +1 -0
- package/dist/web/assets/Explore-ObkEpUyS.js +2 -0
- package/dist/web/assets/Features-CQzNo_WP.js +1 -0
- package/dist/web/assets/Flags-0-RniPJm.js +2 -0
- package/dist/web/assets/Flaky-BPJvNLCA.js +1 -0
- package/dist/web/assets/Impact-CfccsL_k.js +3 -0
- package/dist/web/assets/Jobs-T6m4zhDy.js +5 -0
- package/dist/web/assets/KindPage-BDUvWe2p.js +6 -0
- package/dist/web/assets/Migration-Dqeh4x5u.js +2 -0
- package/dist/web/assets/PageAgent-DNjzIgeY.js +1 -0
- package/dist/web/assets/Product-nYV_scOV.js +7 -0
- package/dist/web/assets/Production-CGSbEWVa.js +1 -0
- package/dist/web/assets/Quality-BIypojZm.js +1 -0
- package/dist/web/assets/Readiness-BlRjwJRg.js +1 -0
- package/dist/web/assets/Record-v2KLI-_Z.js +1 -0
- package/dist/web/assets/Regression-B-jSt4Jz.js +5 -0
- package/dist/web/assets/RelationGraph-8J98lOVG.js +1 -0
- package/dist/web/assets/Reports-GI4u6SyW.js +2 -0
- package/dist/web/assets/Response-mhBThq2b.js +9 -0
- package/dist/web/assets/Responsive-DXu7Ra7K.js +3 -0
- package/dist/web/assets/RunDiff-D0SHDNp0.js +1 -0
- package/dist/web/assets/Runs-C1Gjdi9M.js +2 -0
- package/dist/web/assets/Settings-BGGeuvyF.js +21 -0
- package/dist/web/assets/Steps-D-YG0eJy.js +2 -0
- package/dist/web/assets/TestCases-DC4w77eQ.js +1 -0
- package/dist/web/assets/TestData-CvKWRVVV.js +2 -0
- package/dist/web/assets/TestDebt-D8YzN29_.js +1 -0
- package/dist/web/assets/TestManagement-C5cDCqrD.js +1 -0
- package/dist/web/assets/Tosca-BGUv3RiJ.js +3 -0
- package/dist/web/assets/WhatsNew-B_Gyuv8O.js +1 -0
- package/dist/web/assets/agents-C0Jg2pN8.js +1 -0
- package/dist/web/assets/coverage-BMP6ELFJ.js +5 -0
- package/dist/web/assets/dataParts-DbeCj9ga.js +3 -0
- package/dist/web/assets/diff-BStuTmsN.js +2 -0
- package/dist/web/assets/families-BBFFrUlo.js +1 -0
- package/dist/web/assets/filters-CnAMr286.js +1 -0
- package/dist/web/assets/fold-D_O_VZui.js +1 -0
- package/dist/web/assets/head-CRo48rPt.js +1 -0
- package/dist/web/assets/highlight-BcFZIf59.js +4 -0
- package/dist/web/assets/index-B3JsM7tv.js +64 -0
- package/dist/web/assets/index-CafApcbZ.css +2 -0
- package/dist/web/assets/input-CtzK50ZF.js +1 -0
- package/dist/web/assets/jsx-runtime-LKYXHABd.js +1 -0
- package/dist/web/assets/line-icons-rdF8DYDJ.js +1 -0
- package/dist/web/assets/logos-D4oVWzqa.js +1 -0
- package/dist/web/assets/palette-DAaGSao7.js +1 -0
- package/dist/web/assets/paletteCommands-Co-RlQ8q.js +1 -0
- package/dist/web/assets/parts-D357Wolo.js +1 -0
- package/dist/web/assets/productParts-B8oHRCJF.js +1 -0
- package/dist/web/assets/qualityParts-BLkmIfDY.js +1 -0
- package/dist/web/assets/recordTest-Cez2sDJO.js +1 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/route-BloYJWgw.js +1 -0
- package/dist/web/index.html +12 -6
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/BASAL.md +1 -1
- package/docs/DESKTOP.md +20 -1
- package/docs/EVIDENCE.md +1 -1
- package/docs/MOBILE.md +4 -4
- package/docs/PRODUCT_KNOWLEDGE.md +2 -0
- package/docs/WEB_APP.md +114 -51
- package/docs/user-guide.html +404 -81
- package/forgeqe.example.yaml +3 -3
- package/package.json +1 -1
- package/prompts/page-differs.md +1 -1
- package/prompts/requests-rule.md +1 -1
- package/prompts/test-reviewer.md +1 -1
- package/prompts/test-rules.md +3 -4
- package/skills/web-guidance/LICENSE +202 -0
- package/skills/web-guidance/SKILL.md +76 -0
- package/skills/web-guidance/UPSTREAM +67 -0
- package/skills/web-guidance/references/accessibility/accessibility.md +585 -0
- package/skills/web-guidance/references/accessibility/accessible-error-announcement.md +302 -0
- package/skills/web-guidance/references/accessibility/accessible-generated-content.md +41 -0
- package/skills/web-guidance/references/accessibility/respect-os-text-scale.md +127 -0
- package/skills/web-guidance/references/css/responsive-design.md +16 -0
- package/skills/web-guidance/references/forms/autofill-address-form.md +86 -0
- package/skills/web-guidance/references/forms/autofill-payment-form.md +142 -0
- package/skills/web-guidance/references/forms/autofill-sign-in-form.md +145 -0
- package/skills/web-guidance/references/forms/autofill-sign-up-form.md +155 -0
- package/skills/web-guidance/references/forms/forms.md +415 -0
- package/skills/web-guidance/references/forms/ime-safe-enter-submit.md +115 -0
- package/skills/web-guidance/references/forms/required-field-feedback.md +317 -0
- package/skills/web-guidance/references/forms/select-menu-interaction.md +310 -0
- package/skills/web-guidance/references/forms/slider.md +184 -0
- package/skills/web-guidance/references/forms/sms-otp-form.md +208 -0
- package/skills/web-guidance/references/forms/switch.md +60 -0
- package/skills/web-guidance/references/forms/validate-input-after-interaction.md +406 -0
- package/skills/web-guidance/references/performance/break-up-long-tasks.md +64 -0
- package/skills/web-guidance/references/performance/identify-heavy-scripts.md +69 -0
- package/skills/web-guidance/references/performance/identify-inp-causes.md +105 -0
- package/skills/web-guidance/references/performance/interaction-paint-timing.md +200 -0
- package/skills/web-guidance/references/performance/optimize-image-priority.md +73 -0
- package/skills/web-guidance/references/performance/performance.md +384 -0
- package/skills/web-guidance/references/privacy/privacy.md +247 -0
- package/skills/web-guidance/references/security/passkey-authentication.md +218 -0
- package/skills/web-guidance/references/security/passkey-management.md +310 -0
- package/skills/web-guidance/references/security/passkey-reauthentication.md +142 -0
- package/skills/web-guidance/references/security/passkey-registration.md +186 -0
- package/skills/web-guidance/references/security/passkeys.md +39 -0
- package/skills/web-guidance/references/security/sanitize-untrusted-html.md +105 -0
- package/skills/web-guidance/references/security/secure-external-subresources.md +202 -0
- package/skills/web-guidance/references/security/security.md +390 -0
- package/skills/web-guidance/references/security/trusted-types.md +141 -0
- package/skills/web-guidance/references/security/validate-origins.md +197 -0
- package/skills/web-guidance/references/security/verify-email-ownership.md +235 -0
- package/skills/web-guidance/references/ui-atoms/position-aware-tooltips.md +173 -0
- package/skills/web-guidance/references/ui-atoms/responsive-table.md +122 -0
- package/skills/web-guidance/references/ui-atoms/viewport-aware-dropdowns.md +178 -0
- package/skills/web-guidance/references/ui-behaviors/drag-and-drop.md +108 -0
- package/skills/web-guidance/references/ui-behaviors/light-dismiss-a-dialog.md +89 -0
- package/skills/web-guidance/references/ui-behaviors/motion.md +97 -0
- package/skills/web-guidance/references/ui-behaviors/platform-controls-dismiss-dialog.md +40 -0
- package/skills/web-guidance/references/ui-behaviors/prevent-page-scroll-under-modal-dialog.md +59 -0
- package/skills/web-guidance/references/ui-behaviors/search-hidden-content.md +141 -0
- package/skills/web-guidance/references/ui-behaviors/sortable-table.md +140 -0
- package/skills/web-guidance/references/ui-components/accordion.md +343 -0
- package/skills/web-guidance/references/ui-components/breadcrumbs.md +168 -0
- package/skills/web-guidance/references/ui-components/carousel.md +206 -0
- package/skills/web-guidance/references/ui-components/checkbox.md +144 -0
- package/skills/web-guidance/references/ui-components/dialog.md +218 -0
- package/skills/web-guidance/references/ui-components/hovercard.md +391 -0
- package/skills/web-guidance/references/ui-components/menu.md +415 -0
- package/skills/web-guidance/references/ui-components/navbar.md +281 -0
- package/skills/web-guidance/references/ui-components/navigation-drawer.md +429 -0
- package/skills/web-guidance/references/ui-components/persistent-toast-notifications.md +185 -0
- package/skills/web-guidance/references/ui-components/progress.md +181 -0
- package/skills/web-guidance/references/ui-components/spinner.md +179 -0
- package/skills/web-guidance/references/ui-components/tabs.md +371 -0
- package/skills/web-guidance/references/ui-components/toolbar.md +277 -0
- package/skills/web-guidance/references/user-experience/form-factor-adaptation.md +120 -0
- package/skills/web-guidance/references/user-experience/natural-interactions.md +155 -0
- package/skills/web-guidance/references/visual-design/color.md +43 -0
- package/skills/web-guidance/references/visual-design/dark-mode.md +350 -0
- package/dist/web/assets/AgentWork-DwAI0_Of.js +0 -2
- package/dist/web/assets/ApiTests-C0vFSHmM.js +0 -10
- package/dist/web/assets/Browse-5jfdtRc5.js +0 -2
- package/dist/web/assets/Chat-B3uhI94O.js +0 -3
- package/dist/web/assets/CommandPalette-D2J4nf5y.js +0 -1
- package/dist/web/assets/Compare-CN75w1p9.js +0 -1
- package/dist/web/assets/Cost-QoxyjR95.js +0 -1
- package/dist/web/assets/Data-BAvkcBVt.js +0 -6
- package/dist/web/assets/Desktop-BXdOIalN.js +0 -1
- package/dist/web/assets/DesktopReview-Bl2SrPP0.js +0 -1
- package/dist/web/assets/Evidence-BJ_I52CD.js +0 -1
- package/dist/web/assets/Explore-D9AuyTip.js +0 -2
- package/dist/web/assets/Features-CusGMDR9.js +0 -1
- package/dist/web/assets/Flags-CycGFuUP.js +0 -2
- package/dist/web/assets/Flaky-BcSzJogN.js +0 -1
- package/dist/web/assets/Impact-CJHnyZ21.js +0 -3
- package/dist/web/assets/Jobs-4xcFzEFo.js +0 -5
- package/dist/web/assets/KindPage-BielEIej.js +0 -6
- package/dist/web/assets/Migration-NwanKpJg.js +0 -2
- package/dist/web/assets/PageAgent-CNw4NXva.js +0 -1
- package/dist/web/assets/Product-DS3LJZ4P.js +0 -7
- package/dist/web/assets/Production-D3zsyNIS.js +0 -1
- package/dist/web/assets/Quality-Ctj2YpC4.js +0 -1
- package/dist/web/assets/Readiness-DGcRr_co.js +0 -1
- package/dist/web/assets/Record-Cc-wGe_Y.js +0 -1
- package/dist/web/assets/Regression-DcsbrRa1.js +0 -5
- package/dist/web/assets/Reports-BkCn0-Sf.js +0 -2
- package/dist/web/assets/Response-BP0UwQcW.js +0 -9
- package/dist/web/assets/Responsive-C8U7dumd.js +0 -3
- package/dist/web/assets/RunDiff-BhABuhF_.js +0 -1
- package/dist/web/assets/Runs-OwdWEYBv.js +0 -2
- package/dist/web/assets/Steps-BvzbQyoD.js +0 -2
- package/dist/web/assets/TestCases-CLq_6JA5.js +0 -1
- package/dist/web/assets/TestData-B0oKAhp6.js +0 -2
- package/dist/web/assets/TestDebt-8NLQ5YV_.js +0 -1
- package/dist/web/assets/TestManagement-2LYQ7vsN.js +0 -1
- package/dist/web/assets/Tosca-DfvMpPTG.js +0 -3
- package/dist/web/assets/WhatsNew-BGFNGwqN.js +0 -1
- package/dist/web/assets/families-DYlN5v0i.js +0 -1
- package/dist/web/assets/filters-faaSnoIq.js +0 -1
- package/dist/web/assets/fold-CUjwWAK3.js +0 -1
- package/dist/web/assets/frame-BLPdAXUq.js +0 -13
- package/dist/web/assets/head-CsTxBsO0.js +0 -1
- package/dist/web/assets/index-CxiCvGZq.js +0 -78
- package/dist/web/assets/index-dOIsrzhD.css +0 -2
- package/dist/web/assets/line-icons-CwZWt93L.js +0 -1
- package/dist/web/assets/logos-dGuc1jIM.js +0 -1
- package/dist/web/assets/markdown-BI3F-SJ1.js +0 -10
- package/dist/web/assets/paletteCommands-QJiCuUEr.js +0 -1
- package/dist/web/assets/parts-CdF1f7yS.js +0 -1
- package/dist/web/assets/productParts-hNLD9fN0.js +0 -1
- package/dist/web/assets/qualityParts-CT25lBWU.js +0 -1
- package/dist/web/assets/recordTest-P792aBUt.js +0 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Brand-Consistent Range Slider
|
|
2
|
+
|
|
3
|
+
## Use the native range input
|
|
4
|
+
|
|
5
|
+
Use a labeled `<input type="range">` rather than recreating a slider with `<div>` elements or custom pointer handlers. The native control preserves keyboard and pointer interaction, touch behavior, and accessibility support. Configure `min`, `max`, `step`, and `value` for the use case.
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<label for="range-slider">Volume</label>
|
|
9
|
+
<input type="range" id="range-slider" value="70"/>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If the value requires a formatted label or unit, expose it in ordinary DOM content and update `aria-valuetext` when changed. Do not use `::before` or `::after` on slider pseudo-elements, as generated content on form controls is not interoperable. If a tooltip that follows the thumb is required, anchor it to the thumb with CSS anchor positioning; see `position-aware-tooltips` (references/ui-atoms/position-aware-tooltips.md) for tooltips that stay correctly oriented when they flip.
|
|
13
|
+
|
|
14
|
+
## Choose the styling approach
|
|
15
|
+
|
|
16
|
+
For simple color customization, use `brand-consistent-forms` and retain the browser’s native rendering:
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
input[type="range"] {
|
|
20
|
+
accent-color: var(--brand-color);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`accent-color` is not a complete slider styling API. Its effect on the thumb, track, and fill is user-agent-dependent. Use the pseudo-elements below when the track, thumb, dimensions, shape, or fill must be controlled.
|
|
25
|
+
|
|
26
|
+
## Style the track and thumb
|
|
27
|
+
|
|
28
|
+
Reset default OS styling with `appearance: none`, `margin: 0`, and `border: 0`. To normalize cross-browser rendering, declare WebKit and Firefox pseudo-elements in separate rule blocks, and center the WebKit thumb using `margin-block-start: calc((var(--slider-track-size) - var(--slider-thumb-size)) / 2)` (Firefox centers the thumb automatically). Keep consumer-facing values as custom properties on the input so themes do not target pseudo-elements directly.
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
input[type="range"] {
|
|
32
|
+
--slider-track-size: 0.5rem;
|
|
33
|
+
--slider-thumb-size: 1.25rem;
|
|
34
|
+
--slider-track-radius: 999px;
|
|
35
|
+
--slider-thumb-radius: 50%;
|
|
36
|
+
--slider-track-color: #d9d9d9;
|
|
37
|
+
--slider-fill-color: #06c;
|
|
38
|
+
--slider-thumb-color: var(--slider-fill-color);
|
|
39
|
+
--slider-direction: to right;
|
|
40
|
+
|
|
41
|
+
/* reverse gradient direction for right-to-left layouts */
|
|
42
|
+
&:dir(rtl) {
|
|
43
|
+
--slider-direction: to left;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Read min and max from attributes; --control-value is synced by the script below. */
|
|
47
|
+
--attr-min: attr(min type(<number>), 0);
|
|
48
|
+
--attr-max: attr(max type(<number>), 100);
|
|
49
|
+
--control-value: attr(value type(<number>), 50);
|
|
50
|
+
--slider-progress: calc(
|
|
51
|
+
progress(var(--control-value), var(--attr-min), var(--attr-max)) * 100%
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
appearance: none;
|
|
55
|
+
inline-size: 100%;
|
|
56
|
+
block-size: 2.5rem; /* Preserve a generous interaction area. */
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding: 0;
|
|
59
|
+
border: 0;
|
|
60
|
+
border-radius: 0;
|
|
61
|
+
background: transparent;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* WebKit/Blink. */
|
|
66
|
+
input[type="range"]::-webkit-slider-runnable-track {
|
|
67
|
+
block-size: var(--slider-track-size);
|
|
68
|
+
border: 0;
|
|
69
|
+
border-radius: var(--slider-track-radius);
|
|
70
|
+
background: linear-gradient(
|
|
71
|
+
var(--slider-direction),
|
|
72
|
+
var(--slider-fill-color) var(--slider-progress),
|
|
73
|
+
var(--slider-track-color) var(--slider-progress)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
78
|
+
-webkit-appearance: none;
|
|
79
|
+
appearance: none;
|
|
80
|
+
inline-size: var(--slider-thumb-size);
|
|
81
|
+
block-size: var(--slider-thumb-size);
|
|
82
|
+
margin-block-start: calc(
|
|
83
|
+
(var(--slider-track-size) - var(--slider-thumb-size)) / 2
|
|
84
|
+
);
|
|
85
|
+
border: 0;
|
|
86
|
+
border-radius: var(--slider-thumb-radius);
|
|
87
|
+
background: var(--slider-thumb-color);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Firefox. */
|
|
91
|
+
input[type="range"]::-moz-range-track {
|
|
92
|
+
block-size: var(--slider-track-size);
|
|
93
|
+
border: 0;
|
|
94
|
+
border-radius: var(--slider-track-radius);
|
|
95
|
+
background: var(--slider-track-color);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
input[type="range"]::-moz-range-progress {
|
|
99
|
+
block-size: var(--slider-track-size);
|
|
100
|
+
border-radius: var(--slider-track-radius);
|
|
101
|
+
background: var(--slider-fill-color);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
input[type="range"]::-moz-range-thumb {
|
|
105
|
+
inline-size: var(--slider-thumb-size);
|
|
106
|
+
block-size: var(--slider-thumb-size);
|
|
107
|
+
border: 0;
|
|
108
|
+
border-radius: var(--slider-thumb-radius);
|
|
109
|
+
background: var(--slider-thumb-color);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Ensure the track color has a contrast of at least `3:1` with the background color.
|
|
114
|
+
|
|
115
|
+
Always provide a visible keyboard focus indicator after removing the native appearance. Ensure the focus indicator has a contrast of at least `3:1` with the background color or the adjacent track. Do not use color alone:
|
|
116
|
+
|
|
117
|
+
```css
|
|
118
|
+
input[type="range"]:focus-visible {
|
|
119
|
+
outline: 2px solid var(--slider-fill-color);
|
|
120
|
+
outline-offset: 4px;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Style the active track
|
|
125
|
+
|
|
126
|
+
When the filled portion of the track is styled differently from the unfilled track, Firefox exposes it via `::-moz-range-progress`. WebKit/Blink do not provide an equivalent pseudo-element, so sync the live input value to `--control-value` on `input` events:
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
const slider = document.querySelector('#range-slider');
|
|
130
|
+
|
|
131
|
+
function syncSliderValue() {
|
|
132
|
+
slider.style.setProperty('--control-value', slider.value);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
syncSliderValue();
|
|
136
|
+
slider.addEventListener('input', syncSliderValue);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Limitations
|
|
140
|
+
|
|
141
|
+
- Do not combine WebKit and Firefox pseudo-selectors into a single comma-separated list (e.g. `::-webkit-slider-thumb, ::-moz-range-thumb`); browsers drop the entire rule if an unrecognized vendor pseudo-element is encountered.
|
|
142
|
+
|
|
143
|
+
## Fallbacks
|
|
144
|
+
|
|
145
|
+
### Fallbacks & browser support for accent-color
|
|
146
|
+
|
|
147
|
+
Browser support for accent-color: Limited availability.
|
|
148
|
+
Supported by: Chrome 93 (Aug 2021), Edge 93 (Sep 2021), Firefox 92 (Sep 2021), and Safari 26.2 (Dec 2025).
|
|
149
|
+
|
|
150
|
+
The `accent-color` property is progressive enhancement.
|
|
151
|
+
Browsers that do not support this property will ignore it and use their default UI colors.
|
|
152
|
+
|
|
153
|
+
### Fallbacks & browser support for `progress()` and `attr()`
|
|
154
|
+
|
|
155
|
+
Baseline status for progress(): Newly available. It's been Baseline since 2026-09-01.
|
|
156
|
+
Supported by: Chrome 138 (Jun 2025), Edge 138 (Jun 2025), Firefox 155 (Sep 2026), and Safari 26 (Sep 2025).
|
|
157
|
+
|
|
158
|
+
When `progress()` is unsupported, compute `--slider-progress` with `calc()`:
|
|
159
|
+
|
|
160
|
+
```css
|
|
161
|
+
@supports not (opacity: progress(1, 0, 100)) {
|
|
162
|
+
input[type="range"] {
|
|
163
|
+
--slider-progress: calc(
|
|
164
|
+
(var(--control-value) - var(--attr-min)) /
|
|
165
|
+
(var(--attr-max) - var(--attr-min)) * 100%
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Browser support for attr(): Limited availability.
|
|
172
|
+
Supported by: Chrome 133 (Feb 2025), Edge 133 (Feb 2025), and Firefox 155 (Sep 2026).
|
|
173
|
+
Unsupported in: Safari.
|
|
174
|
+
|
|
175
|
+
When typed `attr()` is unsupported, sync `--attr-min` and `--attr-max` from the input's `min` and `max` attributes in JavaScript:
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
function syncSliderValue() {
|
|
179
|
+
slider.style.setProperty('--attr-min', slider.min || 0);
|
|
180
|
+
slider.style.setProperty('--attr-max', slider.max || 100);
|
|
181
|
+
slider.style.setProperty('--control-value', slider.value);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# SMS OTP form verification
|
|
2
|
+
|
|
3
|
+
Delivering a one-time passcode (OTP) via SMS is a common flow for phone number verification, account recovery, step-up authentication, and payment confirmation. Switching between a browser and an SMS messaging app to memorize or copy-paste a multi-digit code introduces user friction, increases drop-off rates, and leaves users vulnerable to phishing on spoofed domains.
|
|
4
|
+
|
|
5
|
+
Combining semantic `<form>` markup, `<input autocomplete="one-time-code" inputmode="numeric">`, origin-bound SMS formatting (`@domain #code`), and the WebOTP API (`OTPCredential`) creates a layered, progressively enhanced verification flow:
|
|
6
|
+
|
|
7
|
+
1. **Automatic extraction and submission**: Browsers supporting the WebOTP API verify the origin against the `@domain #code` line in the SMS, populate the `<input>`, and trigger verification with a single tap.
|
|
8
|
+
2. **Origin-bound keyboard autofill**: Browsers and operating systems that support `autocomplete="one-time-code"` (such as Safari on iOS, iPadOS, and macOS) parse the `@domain #code` message and suggest the code in the keyboard autofill bar only when the domain matches.
|
|
9
|
+
3. **Frictionless manual entry**: Users entering a code from another device receive a numeric virtual keypad via `inputmode="numeric"` without the usability hazards of `<input type="number">`.
|
|
10
|
+
|
|
11
|
+
## Security considerations
|
|
12
|
+
|
|
13
|
+
SMS OTP verifies possession of a phone number and provides convenient step-up verification, but SMS transport and phone numbers can be subject to SIM swapping, number recycling, and interception. Always pair client-side autofill and the WebOTP API with the origin-bound `@domain #code` SMS format so the browser and OS verify that the target domain matches before suggesting or delivering the code. For primary phishing-resistant authentication, prefer passkeys over SMS-based codes (see `passkeys` (references/security/passkeys.md)).
|
|
14
|
+
|
|
15
|
+
## Semantic form markup
|
|
16
|
+
|
|
17
|
+
Wrap the verification control in a semantic `<form>` element with `method="POST"` and an explicit `<button type="submit">`. Always use a single `<input>` element rather than splitting digits across multiple boxes.
|
|
18
|
+
|
|
19
|
+
- **Use `type="text"` with `inputmode="numeric"`**: Never use `type="number"` for OTP codes. A one-time passcode is an identifier string that may contain leading zeros (such as `012345`), not a countable quantity. Using `type="number"` adds increment/decrement spinner buttons, can strip leading zeros, and allows accidental scroll-wheel value changes. Also avoid `type="tel"`, which is a legacy workaround intended for full telephone numbers. Pair `type="text"` with `inputmode="numeric"` to present a digits-only virtual keyboard on mobile devices.
|
|
20
|
+
- **Add `autocomplete="one-time-code"`**: Instructs browsers and operating systems to suggest incoming SMS verification codes in the autofill bar when the `<input>` is focused.
|
|
21
|
+
- **Place instructional hints above the `<input>`**: Associate a visible `<label>` using `for` and `id`, and place any format instructions (linked via `aria-describedby`) visually **above** the `<input>` so autofill popovers and mobile virtual keyboards never cover the instructions.
|
|
22
|
+
- **Do not split digits across multiple `<input>` elements**: Multi-box OTP patterns (six separate `maxlength="1"` inputs) break native `autocomplete="one-time-code"` autofill in many browsers, hinder copy-pasting, and complicate screen reader navigation. If a segmented visual design is required, style a single `<input>` with `letter-spacing` and a monospace font.
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<form id="otp-form" action="/verify-otp" method="POST">
|
|
26
|
+
<div class="form-group">
|
|
27
|
+
<label for="otp-input">Verification code</label>
|
|
28
|
+
<!-- Place the hint above the input so autofill popovers and mobile keyboards do not obscure it -->
|
|
29
|
+
<p id="otp-format-hint" class="field-hint">
|
|
30
|
+
Enter the 6-digit code sent to your phone.
|
|
31
|
+
</p>
|
|
32
|
+
<!-- MANDATORY: Use a single input with type="text", inputmode="numeric", and autocomplete="one-time-code" -->
|
|
33
|
+
<input
|
|
34
|
+
type="text"
|
|
35
|
+
id="otp-input"
|
|
36
|
+
name="otp"
|
|
37
|
+
inputmode="numeric"
|
|
38
|
+
autocomplete="one-time-code"
|
|
39
|
+
pattern="\d{6}"
|
|
40
|
+
maxlength="6"
|
|
41
|
+
aria-describedby="otp-format-hint"
|
|
42
|
+
required>
|
|
43
|
+
</div>
|
|
44
|
+
<button type="submit">Verify code</button>
|
|
45
|
+
</form>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
/* Optional: Style a single input to visually space digits without splitting the DOM element */
|
|
50
|
+
#otp-input {
|
|
51
|
+
font-family: ui-monospace, monospace;
|
|
52
|
+
font-size: 1.25rem; /* Example value: must be at least 1rem (16px) to prevent mobile browser auto-zoom */
|
|
53
|
+
letter-spacing: 0.35em;
|
|
54
|
+
min-height: 48px;
|
|
55
|
+
padding: 0.5rem 0.75rem;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Origin-bound SMS message format
|
|
61
|
+
|
|
62
|
+
For both the WebOTP API and Safari's domain-bound `autocomplete="one-time-code"` autofill to verify that the code belongs to your website, your backend SMS service must format the **last line** of the text message with the origin domain prefixed by `@` and the OTP prefixed by `#`:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
Your verification code is 123456.
|
|
66
|
+
|
|
67
|
+
@example.com #123456
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Enforce the following formatting rules on the outgoing SMS message:
|
|
71
|
+
|
|
72
|
+
- **Include human-readable text first**: Always start the SMS with a clear human-readable sentence containing the code so users typing it manually on another device can read it easily.
|
|
73
|
+
- **Place `@<domain> #<otp>` on the very last line**: The `@` character must be the first character of the final line, with no trailing lines or signature text after it.
|
|
74
|
+
- **Use only the host domain**: Do not include a URL scheme (`https://` or `http://`), port (`:8080`), or path (`/verify`) in the `@domain` token.
|
|
75
|
+
- **Separate tokens with a single space**: Place exactly one space between `@<domain>` and `#<otp>`, and never include whitespace inside the domain or between `#` and the code.
|
|
76
|
+
|
|
77
|
+
## Integrating the WebOTP API into your verification flow
|
|
78
|
+
|
|
79
|
+
The WebOTP API (`OTPCredential`) requires a Secure Context (`https://` in production, or `http://localhost` during local development). Instead of pasting a disconnected `DOMContentLoaded` script that queries the DOM and calls `form.submit()`, integrate `navigator.credentials.get()` directly into the lifecycle and submission handler of your verification UI:
|
|
80
|
+
|
|
81
|
+
- **Tie the request lifecycle to the active OTP step**: Start listening for the OTP when the verification input is rendered and active (for example, when the OTP step mounts after the user requests an SMS code, and again whenever the user clicks a "Resend code" button).
|
|
82
|
+
- **Manage an `AbortController` across all exit paths**: Pass an `AbortSignal` (`signal: ac.signal`) to `navigator.credentials.get()`. Call `ac.abort()` whenever:
|
|
83
|
+
- The user manually submits the form (or submits a code filled via `autocomplete="one-time-code"`).
|
|
84
|
+
- A new SMS code is requested ("Resend code"), aborting the previous controller before creating a new one.
|
|
85
|
+
- The verification component, dialog, or route unmounts.
|
|
86
|
+
- **Trigger the application's submission handler (`form.requestSubmit()`)**: When `navigator.credentials.get()` resolves with `otp`, set `otpInput.value = otp.code` and call `form.requestSubmit()` (or invoke your verification function directly). Do **NOT** call `form.submit()`, because `form.submit()` bypasses `submit` event listeners (`event.preventDefault()` / `fetch()` handlers) and skips native constraint validation.
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
const otpForm = document.getElementById('otp-form');
|
|
90
|
+
const otpInput = document.getElementById('otp-input');
|
|
91
|
+
|
|
92
|
+
let otpAbortController = null;
|
|
93
|
+
|
|
94
|
+
function stopSmsOtpListener() {
|
|
95
|
+
if (otpAbortController) {
|
|
96
|
+
otpAbortController.abort();
|
|
97
|
+
otpAbortController = null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function startSmsOtpListener() {
|
|
102
|
+
// Feature-detect WebOTP support
|
|
103
|
+
if (!otpInput || !('OTPCredential' in window)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Cancel any previous pending WebOTP request (e.g., when re-sending an SMS code)
|
|
108
|
+
stopSmsOtpListener();
|
|
109
|
+
const ac = new AbortController();
|
|
110
|
+
otpAbortController = ac;
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const otp = await navigator.credentials.get({
|
|
114
|
+
otp: { transport: ['sms'] },
|
|
115
|
+
signal: ac.signal,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (!otp) return;
|
|
119
|
+
otpInput.value = otp.code;
|
|
120
|
+
|
|
121
|
+
// Trigger standard form submission so submit event listeners and validation run
|
|
122
|
+
if (otpForm) {
|
|
123
|
+
otpForm.requestSubmit();
|
|
124
|
+
}
|
|
125
|
+
} catch (err) {
|
|
126
|
+
// Expected when aborted by manual submission, resend, unmount, or user dismissal
|
|
127
|
+
if (err && err.name === 'AbortError') {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
console.error('WebOTP verification error:', err);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
otpForm.addEventListener('submit', async (event) => {
|
|
135
|
+
// MANDATORY: Abort any in-flight WebOTP request when the form is submitted
|
|
136
|
+
stopSmsOtpListener();
|
|
137
|
+
|
|
138
|
+
// Application-specific submission logic (e.g., AJAX fetch or native POST)
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
const formData = new FormData(otpForm);
|
|
141
|
+
// await fetch(otpForm.action, { method: 'POST', body: formData });
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// Start listening when the OTP verification step becomes active
|
|
145
|
+
startSmsOtpListener();
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Cross-origin iframe verification
|
|
149
|
+
|
|
150
|
+
Receiving an SMS OTP inside a cross-origin `<iframe>` is restricted by default and is primarily used for embedded payment confirmation flows (such as 3D Secure verification where `shop.example` embeds an issuer challenge from `bank.example`). Supporting WebOTP inside a cross-origin `<iframe>` requires three coordinated configurations:
|
|
151
|
+
|
|
152
|
+
1. **Bind both origins on the last line of the SMS**: List the top-level embedding domain first (`@shop.example`), followed by `#<otp>`, followed by a space and the embedded iframe domain (`@bank.example`):
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
Your verification code is 123456.
|
|
156
|
+
|
|
157
|
+
@shop.example #123456 @bank.example
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
2. **Send the `Permissions-Policy` HTTP response header**: Delegate `otp-credentials` to the cross-origin iframe origin in the parent document's HTTP headers:
|
|
161
|
+
|
|
162
|
+
```http
|
|
163
|
+
Permissions-Policy: otp-credentials=(self "https://bank.example")
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
3. **Add `allow="otp-credentials"` to the `<iframe>` element**: Explicitly grant the permission policy on the `<iframe>` tag in the embedding page and include a descriptive `title` attribute for screen readers:
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<iframe
|
|
170
|
+
src="https://bank.example/verify"
|
|
171
|
+
allow="otp-credentials"
|
|
172
|
+
title="Payment verification">
|
|
173
|
+
</iframe>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Inside the `<iframe>` document served by `https://bank.example`, run the same `<form>` markup and `navigator.credentials.get({ otp: { transport: ['sms'] }, signal: ac.signal })` verification lifecycle shown above.
|
|
177
|
+
|
|
178
|
+
## Fallback strategies
|
|
179
|
+
|
|
180
|
+
### WebOTP API fallback
|
|
181
|
+
|
|
182
|
+
Browser support for WebOTP: Limited availability.
|
|
183
|
+
Supported by: Chrome 93 (Aug 2021), Edge 93 (Sep 2021), and Safari 27 (Sep 2026).
|
|
184
|
+
Unsupported in: Firefox.
|
|
185
|
+
|
|
186
|
+
If your target browsers do not support the WebOTP API (`OTPCredential`), do not load a third-party JavaScript polyfill, as reading incoming SMS messages requires operating-system-level integration. Instead, rely on the three-tier progressive enhancement built into the `<input>` markup:
|
|
187
|
+
|
|
188
|
+
- **Progressive enhancement experience**: Guard the `navigator.credentials.get({ otp: { transport: ['sms'] } })` call behind `if ('OTPCredential' in window)`. When `OTPCredential` is unavailable:
|
|
189
|
+
1. Browsers that support `autocomplete="one-time-code"` (such as Safari on iOS 14+, iPadOS, and macOS with iCloud SMS relay) parse the `@domain #code` SMS and present the code in the system keyboard autofill bar when the `<input>` is focused.
|
|
190
|
+
2. All other browsers fall back to manual entry in the single `<input type="text" inputmode="numeric" pattern="\d{6}" maxlength="6" required>`, displaying a numeric keypad on mobile devices and submitting via the `<button type="submit">`.
|
|
191
|
+
|
|
192
|
+
### Permissions Policy fallback
|
|
193
|
+
|
|
194
|
+
Browser support for Permissions policy: Limited availability.
|
|
195
|
+
Supported by: Chrome 108 (Nov 2022) and Edge 108 (Dec 2022).
|
|
196
|
+
Unsupported in: Firefox and Safari.
|
|
197
|
+
|
|
198
|
+
If the browser does not support delegating `otp-credentials` via `Permissions-Policy` and `<iframe allow="otp-credentials">`, the embedded verification `<form>` inside the cross-origin `<iframe>` degrades gracefully to `autocomplete="one-time-code"` keyboard suggestions and manual numeric input without throwing unhandled exceptions.
|
|
199
|
+
|
|
200
|
+
### Inputmode and AbortController support
|
|
201
|
+
|
|
202
|
+
Baseline status for inputmode: Widely available. It's been Baseline since 2021-12-07.
|
|
203
|
+
Supported by: Chrome 66 (Apr 2018), Edge 79 (Jan 2020), Firefox 95 (Dec 2021), Safari 12.1 (Mar 2019), and Safari iOS 12.2 (Mar 2019).
|
|
204
|
+
|
|
205
|
+
Baseline status for AbortController and AbortSignal: Widely available. It's been Baseline since 2019-03-25.
|
|
206
|
+
Supported by: Chrome 66 (Apr 2018), Edge 16 (Oct 2017), Firefox 57 (Nov 2017), Safari 12.1 (Mar 2019), and Safari iOS 12.2 (Mar 2019).
|
|
207
|
+
|
|
208
|
+
Both the HTML `inputmode` attribute and `AbortController` (`AbortSignal`) are supported across modern browsers and require no polyfill or fallback code.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Build Accessible Switch Controls
|
|
2
|
+
|
|
3
|
+
Use the HTML `switch` attribute on `<input type="checkbox" switch>` with an associated `<label>` to build a binary on/off toggle that preserves native form submission, keyboard navigation, and screen reader semantics (see `checkbox` (references/ui-components/checkbox.md) and `forms` (references/forms/forms.md)).
|
|
4
|
+
|
|
5
|
+
## Markup
|
|
6
|
+
|
|
7
|
+
Add the boolean `switch` attribute to a standard checkbox input:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<label>
|
|
11
|
+
Enable notifications
|
|
12
|
+
<input id="notifications" type="checkbox" switch>
|
|
13
|
+
</label>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- The label can wrap the input or be associated with `for`/`id`. All styling targets the input, so it doesn't depend on the label structure.
|
|
17
|
+
- When checked, the input submits its standard checkbox value. In JavaScript, listen for `change` (or `input`) events and read `.checked` rather than `.value`.
|
|
18
|
+
|
|
19
|
+
## Styling
|
|
20
|
+
|
|
21
|
+
Customize the control's highlight color using `accent-color` (see `brand-consistent-forms`) and ensure visible focus styling with a contrast ratio of at least 3:1 against adjacent colors (WCAG 1.4.11 Non-text Contrast):
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
input[type="checkbox"][switch] {
|
|
25
|
+
accent-color: var(--accent-color, #1769e0);
|
|
26
|
+
margin: 0;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
input[type="checkbox"][switch]:focus-visible {
|
|
31
|
+
outline: 3px solid var(--focus-color, #d35400);
|
|
32
|
+
outline-offset: 4px;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Fallback strategies
|
|
37
|
+
|
|
38
|
+
### Fallbacks & browser support for switch-control
|
|
39
|
+
|
|
40
|
+
Browser support for <input type="checkbox" switch>: Limited availability.
|
|
41
|
+
Supported by: Safari 17.4 (Mar 2024).
|
|
42
|
+
Unsupported in: Chrome, Edge, and Firefox.
|
|
43
|
+
|
|
44
|
+
If your Baseline target does not support `<input type="checkbox" switch>`, load `input-switch-polyfill` only when `'switch' in HTMLInputElement.prototype` is `false`. Do not load the polyfill unconditionally. The polyfill enhances checkboxes with the `switch` attribute by setting `role="switch"`, applying switch styling (`appearance: none`), syncing computed `accent-color`, and providing pointer drag support.
|
|
45
|
+
|
|
46
|
+
Use the package-loading approach appropriate to your project. The example below assumes your setup can resolve module specifiers:
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
if (!('switch' in HTMLInputElement.prototype)) {
|
|
50
|
+
import('input-switch-polyfill');
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Fallbacks & browser support for accent-color
|
|
55
|
+
|
|
56
|
+
Browser support for accent-color: Limited availability.
|
|
57
|
+
Supported by: Chrome 93 (Aug 2021), Edge 93 (Sep 2021), Firefox 92 (Sep 2021), and Safari 26.2 (Dec 2025).
|
|
58
|
+
|
|
59
|
+
The `accent-color` property is progressive enhancement.
|
|
60
|
+
Browsers that do not support this property will ignore it and use their default UI colors.
|