+ The following example uses the Spin Button Pattern to implement three quantity inputs.
+
+
Similar examples include:
+
+
Toolbar Example: A toolbar that contains a spin button for setting font size.
+
+
+
+
+
+
Example
+
+
+
+
+
+
+
+
+
+
+
+
Accessibility Features
+
+
+ The element with role spinbutton allows text input, for
+ users who prefer to enter a value directly.
+
+
+ The spin button input and its adjacent buttons are visually
+ presented as a singular form field containing an editable value, an
+ increase operation, and a decrease operation.
+
+
+ When either the spin button input or its adjacent buttons have
+ received focus, a single visual focus indicator encompasses all
+ three, reinforcing the relationship between then.
+
+
+ For users who have not set a preference for reduced motion, the
+ focus indicator appears with subtle animation to draw attention.
+
+
+ The increase and decrease buttons:
+
+
+ Are generously sized for ease of use.
+
+
+ Are adjacent to the spin button input so they can be accessed by
+ users of touch-based and voice-based assistive technologies.
+
+
+ Are labeled with the title attribute, providing a
+ human-friendly representation of the plus and minus characters
+ for users of voice control and touch screen. The
+ title attribute also presents a tooltip on hover,
+ clarifying the meaning of each button’s icon.
+
+
+ Use an invisible live region to announce the updated value to
+ when pressed. The live region empties its contents after 3
+ seconds to avoid leaving stale content in the document.
+
+
+ Are excluded from the page Tab sequence with
+ tabindex="-1" because they are redundant with the
+ arrow key support provided to keyboard users.
+
+
+ Can be activated with voice control by speaking a command such
+ as Click add adult.
+
+
+
+
+ When forced colors are enabled, system
+ color keywords are used to ensure visibility and sufficient
+ contrast for the spin button’s content and interactive states.
+
+
+
+
+
+
Keyboard Support
+
The spin buttons provide the following keyboard support described in the Spin Button Pattern.
+
+
+
+
Key
+
Function
+
+
+
+
+
Down Arrow
+
Decreases value by 1.
+
+
+
Up Arrow
+
Increases value by 1.
+
+
+
Home
+
Decreases to minimum value.
+
+
+
End
+
Increases to maximum value.
+
+
+
+
+
+
+
Role, Property, State, and Tabindex Attributes
+
+
+
+
Role
+
Attribute
+
Element
+
Usage
+
+
+
+
+
spinbutton
+
+
input[type="text"]
+
Identifies the input[type="text"] element as a spin button.
+
+
+
+
aria-valuenow="NUMBER"
+
input[type="text"]
+
+
+
Indicates the current numeric value of the spin button.
+
Updated by JavaScript as users change the value of the spin button.
+
+
+
+
+
+
aria-valuemin="NUMBER"
+
input[type="text"]
+
Indicates the minimum allowed value for the spin button.
+
+
+
+
aria-valuemax="NUMBER"
+
input[type="text"]
+
+
+
Indicates the maximum allowed value for the spin button.
+
For the Day spin button, this property is updated based on the value of the Month spin button.
+
+
+
+
+
+
title="NAME_STRING"
+
button
+
Defines the accessible name for each increase and decrease button (Remove adult, Add adult, Remove kid, Add kid, Remove animal, and Add animal).
+
+
+
+
+ aria-controls="ID_REF"
+
+
button
+
Identifies the element whose value will be modified when the button is activated.
+
+
+
+
tabindex="-1"
+
button
+
Removes the decrease and increase buttons from the page Tab sequence while keeping them focusable so they can be accessed with touch-based and voice-based assistive technologies.
+
+
+
+
aria-disabled="true"
+
button
+
Set when the minimum or maximum value has been reached to inform assistive technologies that the button has been disabled.
+
+
+
+
aria-disabled="false"
+
button
+
Set when the value is greater than the minimum value or lesser than the maximum value.
+
+
+
+
aria-hidden="true"
+
span
+
For assistive technology users, hides the visible minus and plus characters in the decrease and increase buttons since they are symbolic of the superior button labels provided by the title attribute.
+
+
+
log
+
+
output
+
Identifies the invisible output element as a log.
+
+
+
+
+ aria-live="polite"
+
+
+ output
+
+
+
+
Triggers a screen reader announcement of the output element’s updated content at the next graceful opportunity.
+
When either the increase or decrease button is pressed, the current value of the spin button is injected into the output element.
+
In keeping with the log role of the output, its contents are emptied 3 seconds after injection.
diff --git a/content/about/coverage-and-quality/prop-coverage.csv b/content/about/coverage-and-quality/prop-coverage.csv
index 64c42b359d..6de4fdfb79 100644
--- a/content/about/coverage-and-quality/prop-coverage.csv
+++ b/content/about/coverage-and-quality/prop-coverage.csv
@@ -7,24 +7,24 @@
"aria-colcount","1","1","Guidance: Using aria-colcount and aria-colindex","Example: Data Grid"
"aria-colindex","3","1","Guidance: Using aria-colcount and aria-colindex","Guidance: Using aria-colindex When Column Indices Are Contiguous","Guidance: Using aria-colindex When Column Indices Are Not Contiguous","Example: Data Grid"
"aria-colspan","1","0","Guidance: Defining cell spans using aria-colspan and aria-rowspan"
-"aria-controls","0","22","Example: Accordion","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Checkbox (Mixed-State)","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Disclosure (Show/Hide) Card","Example: Disclosure (Show/Hide) for Answers to Frequently Asked Questions","Example: Disclosure (Show/Hide) for Image Description","Example: Disclosure Navigation Menu with Top-Level Links","Example: Disclosure Navigation Menu","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation","Example: Toolbar"
+"aria-controls","0","23","Example: Accordion","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Checkbox (Mixed-State)","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Disclosure (Show/Hide) Card","Example: Disclosure (Show/Hide) for Answers to Frequently Asked Questions","Example: Disclosure (Show/Hide) for Image Description","Example: Disclosure Navigation Menu with Top-Level Links","Example: Disclosure Navigation Menu","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Quantity Spin Button","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation","Example: Toolbar"
"aria-current","0","5","Example: Breadcrumb","Example: Disclosure Navigation Menu with Top-Level Links","Example: Disclosure Navigation Menu","Example: Navigation Menubar","Example: Navigation Treeview"
"aria-describedby","1","6","Guidance: Describing by referencing content with aria-describedby","Example: Alert Dialog","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Modal Dialog","Example: Infinite Scrolling Feed","Example: Table"
"aria-details","0","0"
-"aria-disabled","0","3","Example: Alert Dialog","Example: Editor Menubar","Example: Toolbar"
+"aria-disabled","0","4","Example: Alert Dialog","Example: Editor Menubar","Example: Quantity Spin Button","Example: Toolbar"
"aria-dropeffect","0","0"
"aria-errormessage","0","0"
"aria-expanded","0","23","Example: Accordion","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Disclosure (Show/Hide) Card","Example: Disclosure (Show/Hide) for Answers to Frequently Asked Questions","Example: Disclosure (Show/Hide) for Image Description","Example: Disclosure Navigation Menu with Top-Level Links","Example: Disclosure Navigation Menu","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Editor Menubar","Example: Navigation Menubar","Example: Toolbar","Example: Treegrid Email Inbox","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties","Example: Navigation Treeview"
"aria-flowto","0","0"
"aria-grabbed","0","0"
"aria-haspopup","0","9","Example: Date Picker Combobox","Example: Editable Combobox with Grid Popup","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Editor Menubar","Example: Navigation Menubar","Example: Toolbar"
-"aria-hidden","0","16","Example: Button (IDL Version)","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Editor Menubar","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch","Example: Sortable Table","Example: Toolbar"
+"aria-hidden","0","17","Example: Button (IDL Version)","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Editor Menubar","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch","Example: Sortable Table","Example: Toolbar"
"aria-invalid","0","0"
"aria-keyshortcuts","0","0"
"aria-label","1","18","Guidance: Naming with a String Attribute Via aria-label","Example: Breadcrumb","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Link","Example: Editor Menubar","Example: Navigation Menubar","Example: Rating Radio Group","Example: Horizontal Multi-Thumb Slider","Example: Date Picker Spin Button","Example: Table","Example: Toolbar","Example: Treegrid Email Inbox","Example: Navigation Treeview"
"aria-labelledby","1","41","Guidance: Naming with Referenced Content Via aria-labelledby","Example: Accordion","Example: Alert Dialog","Example: Checkbox (Two State)","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Date Picker Dialog","Example: Modal Dialog","Example: Infinite Scrolling Feed","Example: Data Grid","Example: Layout Grid","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Navigation Menubar","Example: Meter","Example: Radio Group Using aria-activedescendant","Example: Rating Radio Group","Example: Radio Group Using Roving tabindex","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Switch Using HTML Button","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties","Example: Navigation Treeview","Example: Complementary Landmark","Example: Form Landmark","Example: Main Landmark","Example: Navigation Landmark","Example: Region Landmark","Example: Search Landmark"
"aria-level","0","2","Example: Treegrid Email Inbox","Example: File Directory Treeview Using Declared Properties"
-"aria-live","0","5","Example: Alert","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Date Picker Combobox","Example: Date Picker Dialog"
+"aria-live","0","6","Example: Alert","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Quantity Spin Button"
"aria-modal","0","4","Example: Alert Dialog","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Modal Dialog"
"aria-multiline","0","0"
"aria-multiselectable","0","1","Example: Listboxes with Rearrangeable Options"
@@ -43,7 +43,7 @@
"aria-selected","0","17","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Date Picker Dialog","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties"
"aria-setsize","0","3","Example: Infinite Scrolling Feed","Example: Treegrid Email Inbox","Example: File Directory Treeview Using Declared Properties"
"aria-sort","1","2","Guidance: Indicating sort order with aria-sort","Example: Data Grid","Example: Sortable Table"
-"aria-valuemax","1","8","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Toolbar"
-"aria-valuemin","0","8","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Toolbar"
-"aria-valuenow","1","8","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Toolbar"
+"aria-valuemax","1","9","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
+"aria-valuemin","0","9","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
+"aria-valuenow","1","9","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
"aria-valuetext","1","5","Guidance: Using aria-valuetext","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Toolbar"
diff --git a/content/about/coverage-and-quality/role-coverage.csv b/content/about/coverage-and-quality/role-coverage.csv
index e760c3cb20..bb97e24eeb 100644
--- a/content/about/coverage-and-quality/role-coverage.csv
+++ b/content/about/coverage-and-quality/role-coverage.csv
@@ -34,7 +34,7 @@
"list","0","0"
"listbox","2","8","Guidance: Listbox Popup Keyboard Interaction","Guidance: Listbox Pattern","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Select-Only Combobox","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox"
"listitem","0","0"
-"log","0","0"
+"log","0","1","Example: Quantity Spin Button"
"main","1","1","Guidance: Main","Example: Main Landmark"
"marquee","0","0"
"math","0","0"
@@ -62,7 +62,7 @@
"searchbox","0","0"
"separator","0","1","Example: Editor Menubar"
"slider","2","5","Guidance: Slider (Multi-Thumb) Pattern","Guidance: Slider Pattern","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider"
-"spinbutton","1","2","Guidance: Spinbutton Pattern","Example: Date Picker Spin Button","Example: Toolbar"
+"spinbutton","1","3","Guidance: Spinbutton Pattern","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
"status","0","0"
"switch","1","3","Guidance: Switch Pattern","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch"
"tab","1","4","Guidance: Keyboard Navigation Between Components (The Tab Sequence)","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation"
diff --git a/content/index/index.html b/content/index/index.html
index 6972acf2d9..877b9221f9 100644
--- a/content/index/index.html
+++ b/content/index/index.html
@@ -195,6 +195,10 @@
diff --git a/content/about/coverage-and-quality/prop-coverage.csv b/content/about/coverage-and-quality/prop-coverage.csv
index 6de4fdfb79..796218971a 100644
--- a/content/about/coverage-and-quality/prop-coverage.csv
+++ b/content/about/coverage-and-quality/prop-coverage.csv
@@ -18,11 +18,11 @@
"aria-flowto","0","0"
"aria-grabbed","0","0"
"aria-haspopup","0","9","Example: Date Picker Combobox","Example: Editable Combobox with Grid Popup","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Editor Menubar","Example: Navigation Menubar","Example: Toolbar"
-"aria-hidden","0","17","Example: Button (IDL Version)","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Editor Menubar","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch","Example: Sortable Table","Example: Toolbar"
+"aria-hidden","0","16","Example: Button (IDL Version)","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Editor Menubar","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Quantity Spin Button","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch","Example: Sortable Table","Example: Toolbar"
"aria-invalid","0","0"
"aria-keyshortcuts","0","0"
-"aria-label","1","18","Guidance: Naming with a String Attribute Via aria-label","Example: Breadcrumb","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Link","Example: Editor Menubar","Example: Navigation Menubar","Example: Rating Radio Group","Example: Horizontal Multi-Thumb Slider","Example: Date Picker Spin Button","Example: Table","Example: Toolbar","Example: Treegrid Email Inbox","Example: Navigation Treeview"
-"aria-labelledby","1","41","Guidance: Naming with Referenced Content Via aria-labelledby","Example: Accordion","Example: Alert Dialog","Example: Checkbox (Two State)","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Date Picker Dialog","Example: Modal Dialog","Example: Infinite Scrolling Feed","Example: Data Grid","Example: Layout Grid","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Navigation Menubar","Example: Meter","Example: Radio Group Using aria-activedescendant","Example: Rating Radio Group","Example: Radio Group Using Roving tabindex","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Switch Using HTML Button","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties","Example: Navigation Treeview","Example: Complementary Landmark","Example: Form Landmark","Example: Main Landmark","Example: Navigation Landmark","Example: Region Landmark","Example: Search Landmark"
+"aria-label","1","17","Guidance: Naming with a String Attribute Via aria-label","Example: Breadcrumb","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Link","Example: Editor Menubar","Example: Navigation Menubar","Example: Rating Radio Group","Example: Horizontal Multi-Thumb Slider","Example: Table","Example: Toolbar","Example: Treegrid Email Inbox","Example: Navigation Treeview"
+"aria-labelledby","1","40","Guidance: Naming with Referenced Content Via aria-labelledby","Example: Accordion","Example: Alert Dialog","Example: Checkbox (Two State)","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Date Picker Dialog","Example: Modal Dialog","Example: Infinite Scrolling Feed","Example: Data Grid","Example: Layout Grid","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Navigation Menubar","Example: Meter","Example: Radio Group Using aria-activedescendant","Example: Rating Radio Group","Example: Radio Group Using Roving tabindex","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Switch Using HTML Button","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties","Example: Navigation Treeview","Example: Complementary Landmark","Example: Form Landmark","Example: Main Landmark","Example: Navigation Landmark","Example: Region Landmark","Example: Search Landmark"
"aria-level","0","2","Example: Treegrid Email Inbox","Example: File Directory Treeview Using Declared Properties"
"aria-live","0","6","Example: Alert","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Quantity Spin Button"
"aria-modal","0","4","Example: Alert Dialog","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Modal Dialog"
@@ -43,7 +43,7 @@
"aria-selected","0","17","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Select-Only Combobox","Example: Editable Combobox with Grid Popup","Example: Date Picker Dialog","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties"
"aria-setsize","0","3","Example: Infinite Scrolling Feed","Example: Treegrid Email Inbox","Example: File Directory Treeview Using Declared Properties"
"aria-sort","1","2","Guidance: Indicating sort order with aria-sort","Example: Data Grid","Example: Sortable Table"
-"aria-valuemax","1","9","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
-"aria-valuemin","0","9","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
-"aria-valuenow","1","9","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
-"aria-valuetext","1","5","Guidance: Using aria-valuetext","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Toolbar"
+"aria-valuemax","1","8","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Quantity Spin Button","Example: Toolbar"
+"aria-valuemin","0","8","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Quantity Spin Button","Example: Toolbar"
+"aria-valuenow","1","8","Guidance: Using aria-valuemin, aria-valuemax and aria-valuenow","Example: Meter","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Quantity Spin Button","Example: Toolbar"
+"aria-valuetext","1","4","Guidance: Using aria-valuetext","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Toolbar"
diff --git a/content/about/coverage-and-quality/role-coverage.csv b/content/about/coverage-and-quality/role-coverage.csv
index bb97e24eeb..e3b4213d86 100644
--- a/content/about/coverage-and-quality/role-coverage.csv
+++ b/content/about/coverage-and-quality/role-coverage.csv
@@ -25,7 +25,7 @@
"generic","0","0"
"grid","3","5","Guidance: Grid Popup Keyboard Interaction","Guidance: Grid (Interactive Tabular Data and Layout Containers) Pattern","Guidance: Grid and Table Properties","Example: Date Picker Combobox","Example: Editable Combobox with Grid Popup","Example: Date Picker Dialog","Example: Data Grid","Example: Layout Grid"
"gridcell","0","3","Example: Editable Combobox with Grid Popup","Example: Layout Grid","Example: Treegrid Email Inbox"
-"group","2","10","Guidance: Radio Group Pattern","Guidance: For Radio Group Contained in a Toolbar","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Checkbox (Two State)","Example: Listbox with Grouped Options","Example: Editor Menubar","Example: Color Viewer Slider","Example: Date Picker Spin Button","Example: Switch Using HTML Button","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties","Example: Navigation Treeview"
+"group","2","9","Guidance: Radio Group Pattern","Guidance: For Radio Group Contained in a Toolbar","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Checkbox (Two State)","Example: Listbox with Grouped Options","Example: Editor Menubar","Example: Color Viewer Slider","Example: Switch Using HTML Button","Example: File Directory Treeview Using Computed Properties","Example: File Directory Treeview Using Declared Properties","Example: Navigation Treeview"
"heading","0","0"
"img","0","0"
"input","0","0"
@@ -62,7 +62,7 @@
"searchbox","0","0"
"separator","0","1","Example: Editor Menubar"
"slider","2","5","Guidance: Slider (Multi-Thumb) Pattern","Guidance: Slider Pattern","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider"
-"spinbutton","1","3","Guidance: Spinbutton Pattern","Example: Date Picker Spin Button","Example: Quantity Spin Button","Example: Toolbar"
+"spinbutton","1","2","Guidance: Spinbutton Pattern","Example: Quantity Spin Button","Example: Toolbar"
"status","0","0"
"switch","1","3","Guidance: Switch Pattern","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch"
"tab","1","4","Guidance: Keyboard Navigation Between Components (The Tab Sequence)","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Experimental Tabs with Action Buttons","Example: Tabs with Automatic Activation","Example: Tabs with Manual Activation"
diff --git a/content/index/index.html b/content/index/index.html
index 877b9221f9..225e1a357a 100644
--- a/content/index/index.html
+++ b/content/index/index.html
@@ -168,7 +168,6 @@
- The following example uses the Spin Button Pattern to implement a date picker.
- It includes three spin buttons: one for setting the day, a second for month, and a third for year.
-
-
Similar examples include:
-
-
Toolbar Example: A toolbar that contains a spin button for setting font size.
- The three spin buttons are wrapped in a group to help assistive technology users understand that all three elements together represent a date.
- The accessible name for the group includes a hidden div that contains a date string that reflects the current values of the three spin buttons.
- This enables screen reader users to easily perceive the date represented by the three buttons without having to navigate to all three buttons and remember the value of each one; it is the screen reader user equivalent to seeing the date at a glance.
-
-
The day spin button uses aria-valuetext to properly pronounce the day, e.g. first, second, third ...
-
The month spin button uses aria-valuetext to properly pronounce the month instead of the numeric value, e.g. January, February, ...
-
On hover, the up and down arrow images enlarge slightly, enlarging the effective target area for increasing or decreasing the spin button value.
-
Focusing a spin button enlarges the increase and decrease buttons to make perceiving keyboard focus easier.
-
- The increase and decrease buttons are not contained within the div with role spinbutton so they can be separately focusable by users of touch screen readers.
- However, they are excluded from the page Tab sequence with tabindex="-1" because they are redundant with the arrow key support provided to keyboard users.
-
-
-
-
-
-
Keyboard Support
-
The spin buttons provide the following keyboard support described in the Spin Button Pattern.
-
-
-
-
Key
-
Function
-
-
-
-
-
Down Arrow
-
-
-
Decreases value 1 step.
-
When focus is on the Day spin button and the value is the first day of the month, changes value to the last day of the month.
-
When focus is on the Month spin button and the value is January, changes value to December.
-
-
-
-
-
Up Arrow
-
-
-
Increases the value 1 step.
-
When focus is on the Day spin button and the value is the last day of the month, changes value to the first day of the month.
-
When focus is on the Month spin button and the value is December, changes value to January.
-
-
-
-
-
Page Down
-
-
-
Decreases the value 5 steps.
-
When focus is on the Day spin button and the value is the fifth day of the month or less, changes value to the last day of the month.
-
When focus is on the Month spin button and the value is the fifth month of the year or less, changes value to December.
-
-
-
-
-
Page Up
-
-
-
Increases the value 5 steps.
-
When focus is on the Day spin button and the value is any of the last five days of the month, changes value to the first day of the month.
-
When focus is on the Month spin button and the value is any of the last five months of the year, changes value to January.
-
-
-
-
-
Home
-
Decreases to minimum value.
-
-
-
End
-
Increases to maximum value.
-
-
-
-
-
-
-
Role, Property, State, and Tabindex Attributes
-
-
-
-
Role
-
Attribute
-
Element
-
Usage
-
-
-
-
-
group
-
-
div
-
-
-
Identifies the div as a group.
-
The group provides a means to inform assistive technology users that the three spin buttons are all related to the single purpose of choosing a date.
-
-
-
-
-
-
aria-labelledby="IDREFs"
-
div
-
-
-
Contains two IDs that reference the div elements that provide the accessible name for the group.
-
One ID refers to the visible label Choose a Date.
-
The second ID refers to a hidden div that contains a string specifying the current date represented by the values of the three spin buttons, which is updated by JavaScript as users change the values of the spin buttons.
-
-
-
-
-
spinbutton
-
-
div
-
Identifies the div element as a spinbutton.
-
-
-
-
aria-label="NAME_STRING"
-
div
-
Defines the accessible name for each spin button (e.g. day, month and year).
-
-
-
-
aria-valuenow="NUMBER"
-
div
-
-
-
Indicates the current numeric value of the spin button.
-
Updated by JavaScript as users change the value of the spin button.
-
-
-
-
-
-
- aria-valuetext="DAY_NUMBER_STRING" or
- aria-valuetext="MONTH_STRING"
-
-
div
-
-
-
For the Day spin button, provides screen reader users with a friendlier pronunciation of the number of the day of the month (i.e. first instead of one).
-
For the Month spin button, provides screen reader users with a friendlier announcement of the month (i.e., January instead of one).
-
-
-
-
-
-
aria-valuemin="NUMBER"
-
div
-
Indicates the minimum allowed value for the spin button.
-
-
-
-
aria-valuemax="NUMBER"
-
div
-
-
-
Indicates the maximum allowed value for the spin button.
-
For the Day spin button, this property is updated based on the value of the Month spin button.
-
-
-
-
-
-
aria-hidden="true"
-
-
-
div.next
-
div.previous
-
-
-
For assistive technology users, hides the text showing the next and previous values that is displayed adjacent to the up and down arrow icons since it would otherwise add superfluous elements to the screen reader reading order that are likely to be more confusing than helpful.
-
-
-
-
aria-label="NAME_STRING"
-
button
-
Defines the accessible name for each increase and decrease button (Next Day, Previous Day, Next Month, Previous Month, Next year, and Previous Year).
-
-
-
-
tabindex="-1"
-
button
-
Removes the decrease and increase buttons from the page Tab sequence while keeping them focusable so they can be accessed with touch-based assistive technologies.
Defines the accessible name for each increase and decrease button (Remove adult, Add adult, Remove kid, Add kid, Remove animal, and Add animal).
+
Defines the accessible name for each increment and decrement button (Remove adult, Add adult, Remove kid, Add kid, Remove animal, and Add animal).
@@ -333,15 +349,15 @@
Role, Property, State, and Tabindex Attributes
tabindex="-1"
button
-
Removes the decrease and increase buttons from the page Tab sequence while keeping them focusable so they can be accessed with touch-based and voice-based assistive technologies.
+
Removes the increment and decrement buttons from the page Tab sequence while keeping them focusable so they can be accessed with touch-based and voice-based assistive technologies.
-
+
aria-disabled="true"
button
Set when the minimum or maximum value has been reached to inform assistive technologies that the button has been disabled.
-
+
aria-disabled="false"
button
@@ -351,27 +367,18 @@
Role, Property, State, and Tabindex Attributes
aria-hidden="true"
span
-
For assistive technology users, hides the visible minus and plus characters in the decrease and increase buttons since they are symbolic of the superior button labels provided by the title attribute.
+
For assistive technology users, hides the visible minus and plus characters in the increment and decrement buttons since they are symbolic of the superior button labels provided by the title attribute.
-
-
log
+
+
status
-
output
-
Identifies the invisible output element as a log.
-
-
-
-
- aria-live="polite"
-
-
- output
-
+
div
-
Triggers a screen reader announcement of the output element’s updated content at the next graceful opportunity.
-
When either the increase or decrease button is pressed, the current value of the spin button is injected into the output element.
-
In keeping with the log role of the output, its contents are emptied 3 seconds after injection.
+
Identifies the invisible div as a status element with an implicit aria-live value of polite.
+
Triggers a screen reader announcement of the status element’s updated content at the next graceful opportunity.
+
When either the increment or decrement button is pressed, the current value of the spin button is injected into the status element.
+
Its contents are emptied 2000 milliseconds after injection.
From 7adc5db2b0ab207ead06b16374275507fe50b44e Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Thu, 7 Aug 2025 22:58:57 -0700
Subject: [PATCH 16/25] initial tests
---
test/tests/spinbutton_quantity.js | 440 ++++++++++++++++++++++++++++++
1 file changed, 440 insertions(+)
create mode 100644 test/tests/spinbutton_quantity.js
diff --git a/test/tests/spinbutton_quantity.js b/test/tests/spinbutton_quantity.js
new file mode 100644
index 0000000000..be98eba3a4
--- /dev/null
+++ b/test/tests/spinbutton_quantity.js
@@ -0,0 +1,440 @@
+const { ariaTest } = require('..');
+const { By, Key } = require('selenium-webdriver');
+const assertAttributeValues = require('../util/assertAttributeValues');
+const assertAriaRoles = require('../util/assertAriaRoles');
+
+const exampleFile =
+ 'content/patterns/spinbutton/examples/quantity-spinbutton.html';
+
+const ex = {
+ spin: {
+ id: 'adults',
+ sel: '#adults',
+ min: '1',
+ max: '8',
+ now: '1',
+ },
+
+ inc: {
+ sel: '[aria-controls="adults"][data-spinbutton-operation="increment"]',
+ accname: 'Add adult',
+ },
+
+ dec: {
+ sel: '[aria-controls="adults"][data-spinbutton-operation="decrement"]',
+ accname: 'Remove adult',
+ },
+
+ status: {
+ sel: 'div[for="adults"]',
+ selfDestruct: '2000',
+ },
+};
+
+ex.inc.symbolSel = ex.inc.sel + ' > span';
+ex.dec.symbolSel = ex.dec.sel + ' > span';
+(ex.inputScenarios = {
+ 0: ex.spin.min,
+ 1: ex.spin.min,
+ 4: '4',
+ 8: ex.spin.max,
+ 13: ex.spin.max,
+ abc: ex.spin.min,
+ '-7': '7',
+}),
+ // Attributes
+
+ ariaTest(
+ 'role="spinbutton" on input element',
+ exampleFile,
+ 'spinbutton-role',
+ async (t) => {
+ await assertAriaRoles(t, 'example', 'spinbutton', '3', 'input');
+ }
+ );
+
+ariaTest(
+ '"aria-valuemin" represents the minimum value on spinbuttons',
+ exampleFile,
+ 'spinbutton-aria-valuemin',
+ async (t) => {
+ await assertAttributeValues(t, ex.spin.sel, 'aria-valuemin', ex.spin.min);
+ }
+);
+
+ariaTest(
+ '"aria-valuemax" represents the maximum value on spinbuttons',
+ exampleFile,
+ 'spinbutton-aria-valuemax',
+ async (t) => {
+ await assertAttributeValues(t, ex.spin.sel, 'aria-valuemax', ex.spin.max);
+ }
+);
+
+ariaTest(
+ '"aria-valuenow" reflects spinbutton value as a number',
+ exampleFile,
+ 'spinbutton-aria-valuenow',
+ async (t) => {
+ await assertAttributeValues(t, ex.spin.sel, 'aria-valuenow', ex.spin.now);
+ }
+);
+
+ariaTest(
+ '"tabindex=-1" removes increment and decrement buttons from page tab order',
+ exampleFile,
+ 'button-tabindex',
+ async (t) => {
+ await assertAttributeValues(t, ex.inc.sel, 'tabindex', '-1');
+ await assertAttributeValues(t, ex.dec.sel, 'tabindex', '-1');
+ }
+);
+
+ariaTest(
+ 'increment and decrement buttons use aria-controls to reference spinner',
+ exampleFile,
+ 'button-aria-controls',
+ async (t) => {
+ await assertAttributeValues(t, ex.inc.sel, 'aria-controls', ex.spin.id);
+ await assertAttributeValues(t, ex.dec.sel, 'aria-controls', ex.spin.id);
+ }
+);
+
+ariaTest(
+ '"title" provides accessible name for the increment and decrement buttons',
+ exampleFile,
+ 'button-title',
+ async (t) => {
+ await assertAttributeValues(t, ex.inc.sel, 'title', ex.inc.accname);
+ await assertAttributeValues(t, ex.dec.sel, 'title', ex.dec.accname);
+ }
+);
+
+ariaTest(
+ '"aria-hidden" hides symbolic accname equivalent from screen reader users',
+ exampleFile,
+ 'span-aria-hidden',
+ async (t) => {
+ await assertAttributeValues(t, ex.inc.symbolSel, 'aria-hidden', 'true');
+ await assertAttributeValues(t, ex.dec.symbolSel, 'aria-hidden', 'true');
+ }
+);
+
+ariaTest(
+ 'role="status" on div element',
+ exampleFile,
+ 'status-role',
+ async (t) => {
+ await assertAriaRoles(t, 'example', 'status', '3', 'div');
+ }
+);
+
+// keys
+
+ariaTest('end', exampleFile, 'spinbutton-end', async (t) => {
+ const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
+ const max = parseInt(ex.spin.max);
+
+ // Send end key
+ await spinner.sendKeys(Key.END);
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ max,
+ `After sending end key, aria-valuenow should be the maximum value: ${max}`
+ );
+
+ // Check that the decrement button is not disabled.
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'false');
+
+ // Check that the increment button is disabled.
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'true');
+});
+
+ariaTest('home', exampleFile, 'spinbutton-home', async (t) => {
+ const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
+ const min = parseInt(ex.spin.min);
+
+ // Send home key
+ await spinner.sendKeys(Key.HOME);
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ min,
+ `After sending end key, aria-valuenow should be the minimum value: ${min}`
+ );
+
+ // Check that the decrement button is disabled.
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'true');
+
+ // Check that the increment button is not disabled.
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'false');
+});
+
+ariaTest('up arrow', exampleFile, 'spinbutton-up-arrow', async (t) => {
+ const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
+ const min = parseInt(ex.spin.min);
+ const max = parseInt(ex.spin.max);
+ let val = min;
+
+ // Send home key
+ await spinner.sendKeys(Key.HOME);
+
+ // Send arrow keys up to and including the maximum value.
+ while (++val <= max) {
+ await spinner.sendKeys(Key.ARROW_UP);
+
+ // Check that aria-valuenow is updated correctly.
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ val,
+ `After sending ${val - 1} up arrows, aria-valuenow should be ${val}`
+ );
+ }
+
+ // Check that the decrement button is no longer disabled.
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'false');
+
+ // Check that the increment button is now disabled.
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'true');
+
+ // Send one more and check that aria-valuenow remains at the maximum value.
+ await spinner.sendKeys(Key.ARROW_UP);
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ max,
+ `After sending one more up arrow, aria-valuenow should still be ${max}`
+ );
+
+ // Check that the decrement button is still not disabled
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'false');
+
+ // Check that the increment button is still disabled
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'true');
+});
+
+ariaTest('down arrow', exampleFile, 'spinbutton-down-arrow', async (t) => {
+ const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
+ const min = parseInt(ex.spin.min);
+ const max = parseInt(ex.spin.max);
+ let val = max;
+
+ // Send end key
+ await spinner.sendKeys(Key.END);
+
+ // Send arrow keys down to and including the minimum value.
+ while (--val >= min) {
+ await spinner.sendKeys(Key.ARROW_DOWN);
+
+ // Check that aria-valuenow is updated correctly.
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ val,
+ `After sending ${val + 1} down arrows, aria-valuenow should be ${val}`
+ );
+ }
+
+ // Check that the decrement button is now disabled.
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'true');
+
+ // Check that the increment button is no longer disabled.
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'false');
+
+ // Send one more and check that aria-valuenow remains at the maximum value.
+ await spinner.sendKeys(Key.ARROW_DOWN);
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ min,
+ `After sending one more up arrow, aria-valuenow should still be ${min}`
+ );
+
+ // Check that the decrement button is still disabled.
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'true');
+
+ // Check that the increment button is still not disabled.
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'false');
+});
+
+// text input
+
+ariaTest(
+ 'Expected behavior for direct input of numeric values',
+ exampleFile,
+ 'standard-single-line-editing-keys',
+ async (t) => {
+ const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
+ const min = parseInt(ex.spin.min);
+ const max = parseInt(ex.spin.max);
+
+ for (const inputScenario of Object.entries(ex.inputScenarios)) {
+ const [input, expected] = inputScenario;
+
+ // Input the value
+ await spinner.clear();
+ await spinner.sendKeys(Key.chord(Key.COMMAND, 'a'));
+ await spinner.sendKeys(input);
+
+ // Force blur after input
+ await t.context.session.executeScript((el) => el.blur(), spinner);
+
+ // Check that aria-valuenow is updated correctly.
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ parseInt(expected),
+ `After inputting “${input}”, aria-valuenow should be ${expected}`
+ );
+
+ // Check that the decrement button has the expected aria-disabled state.
+ await assertAttributeValues(
+ t,
+ ex.dec.sel,
+ 'aria-disabled',
+ parseInt(expected) <= parseInt(min) ? 'true' : 'false'
+ );
+
+ // Check that the increment button has the expected aria-disabled state.
+ await assertAttributeValues(
+ t,
+ ex.inc.sel,
+ 'aria-disabled',
+ parseInt(expected) >= parseInt(max) ? 'true' : 'false'
+ );
+ }
+ }
+);
+
+// incerment and decrement buttons
+
+ariaTest('increment button', exampleFile, 'increment-button', async (t) => {
+ const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
+ const status = await t.context.session.findElement(By.css(ex.status.sel));
+ const button = await t.context.session.findElement(By.css(ex.inc.sel));
+ const min = parseInt(ex.spin.min);
+ const max = parseInt(ex.spin.max);
+ let val = min;
+
+ // Send home key
+ await spinner.sendKeys(Key.HOME);
+
+ // Click increment button up to and including the maximum value.
+ while (++val <= max) {
+ await button.click();
+
+ // Check that aria-valuenow is updated correctly.
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ val,
+ `After clicking ${val - 1} times, aria-valuenow should be ${val}`
+ );
+
+ // Check that the status element has the expected value.
+ t.is(
+ await status.getText(),
+ String(val),
+ `After clicking ${val - 1} times, status should be ${val}`
+ );
+ }
+
+ // Check that the decrement button is no longer disabled.
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'false');
+
+ // Check that the increment button is now disabled.
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'true');
+
+ // Send one more and check that aria-valuenow remains at the maximum value.
+ await button.click();
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ max,
+ `After clicking once more, aria-valuenow should still be ${max}`
+ );
+
+ // Check that the status element has the expected value.
+ t.is(
+ await status.getText(),
+ String(max),
+ `After clicking once more, status should still be ${max}`
+ );
+
+ // Check that the decrement button is still not disabled
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'false');
+
+ // Check that the increment button is still disabled
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'true');
+
+ // Wait for the status to self-destruct
+ await t.context.session.sleep(parseInt(ex.status.selfDestruct) + 500);
+
+ // Check that the status element is empty
+ t.is(
+ await status.getText(),
+ '',
+ `After waiting for the status self-destruct timer, it should be empty`
+ );
+});
+
+ariaTest('decrement button', exampleFile, 'decrement-button', async (t) => {
+ const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
+ const status = await t.context.session.findElement(By.css(ex.status.sel));
+ const button = await t.context.session.findElement(By.css(ex.dec.sel));
+ const min = parseInt(ex.spin.min);
+ const max = parseInt(ex.spin.max);
+ let val = max;
+
+ // Send end key
+ await spinner.sendKeys(Key.END);
+
+ // Click decrement button down to and including the minimum value.
+ while (--val >= min) {
+ await button.click();
+
+ // Check that aria-valuenow is updated correctly.
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ val,
+ `After clicking ${val + 1} times, aria-valuenow should be ${val}`
+ );
+
+ // Check that the status element has the expected value.
+ t.is(
+ await status.getText(),
+ String(val),
+ `After clicking ${val + 1} times, status should be ${val}`
+ );
+ }
+
+ // Check that the decrement button is now disabled.
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'true');
+
+ // Check that the increment button is no longer disabled.
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'false');
+
+ // Send one more and check that aria-valuenow remains at the maximum value.
+ await button.click();
+ t.is(
+ parseInt(await spinner.getAttribute('aria-valuenow')),
+ min,
+ `After clicking once more, aria-valuenow should still be ${min}`
+ );
+
+ // Check that the status element has the expected value.
+ t.is(
+ await status.getText(),
+ String(min),
+ `After clicking once more, status should still be ${min}`
+ );
+
+ // Check that the decrement button is still disabled
+ await assertAttributeValues(t, ex.dec.sel, 'aria-disabled', 'true');
+
+ // Check that the increment button is still not disabled
+ await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'false');
+
+ // Wait for the status to self-destruct
+ await t.context.session.sleep(parseInt(ex.status.selfDestruct) + 500);
+
+ // Check that the status element is empty
+ t.is(
+ await status.getText(),
+ '',
+ `After waiting for the status self-destruct timer, it should be empty`
+ );
+});
From e37e5a481c65dc233152d470757e050b2034e8a0 Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Thu, 7 Aug 2025 23:17:18 -0700
Subject: [PATCH 17/25] use native output
---
.../coverage-and-quality-report.html | 19 ++---
.../coverage-and-quality/role-coverage.csv | 2 +-
content/index/index.html | 4 --
.../examples/js/quantity-spinbutton.js | 10 +--
.../examples/quantity-spinbutton.html | 27 ++++---
cspell.json | 1 +
test/tests/spinbutton_quantity.js | 71 ++++++++++---------
7 files changed, 62 insertions(+), 72 deletions(-)
diff --git a/content/about/coverage-and-quality/coverage-and-quality-report.html b/content/about/coverage-and-quality/coverage-and-quality-report.html
index 418c918b74..aa53c9b019 100644
--- a/content/about/coverage-and-quality/coverage-and-quality-report.html
+++ b/content/about/coverage-and-quality/coverage-and-quality-report.html
@@ -53,8 +53,8 @@
For assistive technology users, hides the visible minus and plus characters in the increment and decrement buttons since they are symbolic of the superior button labels provided by the title attribute.
-
-
status
+
-
div
+
+
output
-
Identifies the invisible div as a status element with an implicit aria-live value of polite.
-
Triggers a screen reader announcement of the status element’s updated content at the next graceful opportunity.
-
When either the increment or decrement button is pressed, the current value of the spin button is injected into the status element.
+
An element with an implicit role of status and an implicit aria-live value of polite.
+
Triggers a screen reader announcement of the output element’s updated content at the next graceful opportunity.
+
When either the increment or decrement button is pressed, the current value of the spin button is injected into the output element.
Its contents are emptied 2000 milliseconds after injection.
diff --git a/cspell.json b/cspell.json
index dec723cc19..aa7bfc6548 100644
--- a/cspell.json
+++ b/cspell.json
@@ -4,6 +4,7 @@
"words": [
"accesskey",
"Accesskey",
+ "accname",
"activedescendants",
"affordance",
"Ahlefeldt",
diff --git a/test/tests/spinbutton_quantity.js b/test/tests/spinbutton_quantity.js
index be98eba3a4..893f34e011 100644
--- a/test/tests/spinbutton_quantity.js
+++ b/test/tests/spinbutton_quantity.js
@@ -25,8 +25,8 @@ const ex = {
accname: 'Remove adult',
},
- status: {
- sel: 'div[for="adults"]',
+ output: {
+ sel: 'output[for="adults"]',
selfDestruct: '2000',
},
};
@@ -120,14 +120,15 @@ ariaTest(
}
);
-ariaTest(
- 'role="status" on div element',
- exampleFile,
- 'status-role',
- async (t) => {
- await assertAriaRoles(t, 'example', 'status', '3', 'div');
- }
-);
+ariaTest('output element exists', exampleFile, 'output', async (t) => {
+ let output = await t.context.queryElements(t, ex.output.sel);
+
+ t.is(
+ output.length,
+ 1,
+ 'One output element should be found by selector: ' + ex.output.sel
+ );
+});
// keys
@@ -301,11 +302,11 @@ ariaTest(
}
);
-// incerment and decrement buttons
+// increment and decrement buttons
ariaTest('increment button', exampleFile, 'increment-button', async (t) => {
const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
- const status = await t.context.session.findElement(By.css(ex.status.sel));
+ const output = await t.context.session.findElement(By.css(ex.output.sel));
const button = await t.context.session.findElement(By.css(ex.inc.sel));
const min = parseInt(ex.spin.min);
const max = parseInt(ex.spin.max);
@@ -325,11 +326,11 @@ ariaTest('increment button', exampleFile, 'increment-button', async (t) => {
`After clicking ${val - 1} times, aria-valuenow should be ${val}`
);
- // Check that the status element has the expected value.
+ // Check that the output element has the expected value.
t.is(
- await status.getText(),
+ await output.getText(),
String(val),
- `After clicking ${val - 1} times, status should be ${val}`
+ `After clicking ${val - 1} times, output should be ${val}`
);
}
@@ -347,11 +348,11 @@ ariaTest('increment button', exampleFile, 'increment-button', async (t) => {
`After clicking once more, aria-valuenow should still be ${max}`
);
- // Check that the status element has the expected value.
+ // Check that the output element has the expected value.
t.is(
- await status.getText(),
+ await output.getText(),
String(max),
- `After clicking once more, status should still be ${max}`
+ `After clicking once more, output should still be ${max}`
);
// Check that the decrement button is still not disabled
@@ -360,20 +361,20 @@ ariaTest('increment button', exampleFile, 'increment-button', async (t) => {
// Check that the increment button is still disabled
await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'true');
- // Wait for the status to self-destruct
- await t.context.session.sleep(parseInt(ex.status.selfDestruct) + 500);
+ // Wait for the output to self-destruct
+ await t.context.session.sleep(parseInt(ex.output.selfDestruct) + 500);
- // Check that the status element is empty
+ // Check that the output element is empty
t.is(
- await status.getText(),
+ await output.getText(),
'',
- `After waiting for the status self-destruct timer, it should be empty`
+ `After waiting for the output self-destruct timer, it should be empty`
);
});
ariaTest('decrement button', exampleFile, 'decrement-button', async (t) => {
const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
- const status = await t.context.session.findElement(By.css(ex.status.sel));
+ const output = await t.context.session.findElement(By.css(ex.output.sel));
const button = await t.context.session.findElement(By.css(ex.dec.sel));
const min = parseInt(ex.spin.min);
const max = parseInt(ex.spin.max);
@@ -393,11 +394,11 @@ ariaTest('decrement button', exampleFile, 'decrement-button', async (t) => {
`After clicking ${val + 1} times, aria-valuenow should be ${val}`
);
- // Check that the status element has the expected value.
+ // Check that the output element has the expected value.
t.is(
- await status.getText(),
+ await output.getText(),
String(val),
- `After clicking ${val + 1} times, status should be ${val}`
+ `After clicking ${val + 1} times, output should be ${val}`
);
}
@@ -415,11 +416,11 @@ ariaTest('decrement button', exampleFile, 'decrement-button', async (t) => {
`After clicking once more, aria-valuenow should still be ${min}`
);
- // Check that the status element has the expected value.
+ // Check that the output element has the expected value.
t.is(
- await status.getText(),
+ await output.getText(),
String(min),
- `After clicking once more, status should still be ${min}`
+ `After clicking once more, output should still be ${min}`
);
// Check that the decrement button is still disabled
@@ -428,13 +429,13 @@ ariaTest('decrement button', exampleFile, 'decrement-button', async (t) => {
// Check that the increment button is still not disabled
await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'false');
- // Wait for the status to self-destruct
- await t.context.session.sleep(parseInt(ex.status.selfDestruct) + 500);
+ // Wait for the output to self-destruct
+ await t.context.session.sleep(parseInt(ex.output.selfDestruct) + 500);
- // Check that the status element is empty
+ // Check that the output element is empty
t.is(
- await status.getText(),
+ await output.getText(),
'',
- `After waiting for the status self-destruct timer, it should be empty`
+ `After waiting for the output self-destruct timer, it should be empty`
);
});
From 94a2833b405f5ca58521ed07b1d09ea203d78102 Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Thu, 7 Aug 2025 23:29:44 -0700
Subject: [PATCH 18/25] =?UTF-8?q?use=20utility=20to=20specify=20correct=20?=
=?UTF-8?q?=E2=80=9Cselect=20all=E2=80=9D=20keystroke=20for=20environment?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
test/tests/spinbutton_quantity.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/test/tests/spinbutton_quantity.js b/test/tests/spinbutton_quantity.js
index 893f34e011..4d069cc25c 100644
--- a/test/tests/spinbutton_quantity.js
+++ b/test/tests/spinbutton_quantity.js
@@ -2,6 +2,7 @@ const { ariaTest } = require('..');
const { By, Key } = require('selenium-webdriver');
const assertAttributeValues = require('../util/assertAttributeValues');
const assertAriaRoles = require('../util/assertAriaRoles');
+const translatePlatformKey = require('../util/translatePlatformKeys');
const exampleFile =
'content/patterns/spinbutton/examples/quantity-spinbutton.html';
@@ -264,13 +265,15 @@ ariaTest(
const spinner = await t.context.session.findElement(By.css(ex.spin.sel));
const min = parseInt(ex.spin.min);
const max = parseInt(ex.spin.max);
+ const selectAllKeys = translatePlatformKey([Key.CONTROL, 'a']);
+ const selectAllChord = Key.chord(...selectAllKeys);
for (const inputScenario of Object.entries(ex.inputScenarios)) {
const [input, expected] = inputScenario;
// Input the value
await spinner.clear();
- await spinner.sendKeys(Key.chord(Key.COMMAND, 'a'));
+ await spinner.sendKeys(selectAllChord);
await spinner.sendKeys(input);
// Force blur after input
From 6535e08174e7c46211ec7ad7d02512fd6f1d24b9 Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Fri, 8 Aug 2025 18:19:29 -0700
Subject: [PATCH 19/25] typos
---
test/tests/spinbutton_quantity.js | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/test/tests/spinbutton_quantity.js b/test/tests/spinbutton_quantity.js
index 4d069cc25c..3877a47b35 100644
--- a/test/tests/spinbutton_quantity.js
+++ b/test/tests/spinbutton_quantity.js
@@ -34,7 +34,7 @@ const ex = {
ex.inc.symbolSel = ex.inc.sel + ' > span';
ex.dec.symbolSel = ex.dec.sel + ' > span';
-(ex.inputScenarios = {
+ex.inputScenarios = {
0: ex.spin.min,
1: ex.spin.min,
4: '4',
@@ -42,17 +42,18 @@ ex.dec.symbolSel = ex.dec.sel + ' > span';
13: ex.spin.max,
abc: ex.spin.min,
'-7': '7',
-}),
- // Attributes
-
- ariaTest(
- 'role="spinbutton" on input element',
- exampleFile,
- 'spinbutton-role',
- async (t) => {
- await assertAriaRoles(t, 'example', 'spinbutton', '3', 'input');
- }
- );
+};
+
+// Attributes
+
+ariaTest(
+ 'role="spinbutton" on input element',
+ exampleFile,
+ 'spinbutton-role',
+ async (t) => {
+ await assertAriaRoles(t, 'example', 'spinbutton', '3', 'input');
+ }
+);
ariaTest(
'"aria-valuemin" represents the minimum value on spinbuttons',
From f0141208c2100257b76240c9a39a998d3b4cff2b Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Fri, 8 Aug 2025 18:21:10 -0700
Subject: [PATCH 20/25] lint
---
.../spinbutton/examples/css/quantity-spinbutton.css | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/content/patterns/spinbutton/examples/css/quantity-spinbutton.css b/content/patterns/spinbutton/examples/css/quantity-spinbutton.css
index a9fbba55c6..c9af4f4df1 100644
--- a/content/patterns/spinbutton/examples/css/quantity-spinbutton.css
+++ b/content/patterns/spinbutton/examples/css/quantity-spinbutton.css
@@ -25,7 +25,9 @@
border: 1px solid color-mix(in srgb, ghostwhite, darkblue 10%);
border-radius: 0.5rem;
- *, *::before, *::after {
+ *,
+ *::before,
+ *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
@@ -93,7 +95,8 @@
outline-offset: var(--length-s);
}
- input, button {
+ input,
+ button {
appearance: none;
font: inherit;
font-weight: bold;
@@ -113,7 +116,9 @@
field-sizing: content;
font-variant-numeric: tabular-nums;
- &, &:hover, &:focus {
+ &,
+ &:hover,
+ &:focus {
border: none;
}
}
From c30dd2255f4b473cb0f658b0138c024caf7306f4 Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Tue, 19 Aug 2025 11:10:49 -0700
Subject: [PATCH 21/25] Update test/tests/spinbutton_quantity.js
Co-authored-by: Howard Edwards
---
test/tests/spinbutton_quantity.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/tests/spinbutton_quantity.js b/test/tests/spinbutton_quantity.js
index 3877a47b35..05e7fc8ee0 100644
--- a/test/tests/spinbutton_quantity.js
+++ b/test/tests/spinbutton_quantity.js
@@ -162,7 +162,7 @@ ariaTest('home', exampleFile, 'spinbutton-home', async (t) => {
t.is(
parseInt(await spinner.getAttribute('aria-valuenow')),
min,
- `After sending end key, aria-valuenow should be the minimum value: ${min}`
+ `After sending home key, aria-valuenow should be the minimum value: ${min}`
);
// Check that the decrement button is disabled.
From ad8fba8e8b75f63af018b05fb32cdfcd6ed67ae8 Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Tue, 19 Aug 2025 14:01:28 -0700
Subject: [PATCH 22/25] add white space input test
---
test/tests/spinbutton_quantity.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/tests/spinbutton_quantity.js b/test/tests/spinbutton_quantity.js
index 05e7fc8ee0..484c67068c 100644
--- a/test/tests/spinbutton_quantity.js
+++ b/test/tests/spinbutton_quantity.js
@@ -42,6 +42,7 @@ ex.inputScenarios = {
13: ex.spin.max,
abc: ex.spin.min,
'-7': '7',
+ ' ': ex.spin.min,
};
// Attributes
From daaabe010474201196a7ae5995e7aad49f1c5bcd Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Tue, 19 Aug 2025 14:10:07 -0700
Subject: [PATCH 23/25] remove sleep buffer
---
test/tests/spinbutton_quantity.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/tests/spinbutton_quantity.js b/test/tests/spinbutton_quantity.js
index 484c67068c..9eaf64a2e1 100644
--- a/test/tests/spinbutton_quantity.js
+++ b/test/tests/spinbutton_quantity.js
@@ -367,7 +367,7 @@ ariaTest('increment button', exampleFile, 'increment-button', async (t) => {
await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'true');
// Wait for the output to self-destruct
- await t.context.session.sleep(parseInt(ex.output.selfDestruct) + 500);
+ await t.context.session.sleep(parseInt(ex.output.selfDestruct));
// Check that the output element is empty
t.is(
@@ -435,7 +435,7 @@ ariaTest('decrement button', exampleFile, 'decrement-button', async (t) => {
await assertAttributeValues(t, ex.inc.sel, 'aria-disabled', 'false');
// Wait for the output to self-destruct
- await t.context.session.sleep(parseInt(ex.output.selfDestruct) + 500);
+ await t.context.session.sleep(parseInt(ex.output.selfDestruct));
// Check that the output element is empty
t.is(
From b7775b14c0416811e6af1070c063f459ef4700df Mon Sep 17 00:00:00 2001
From: Adam Page
Date: Tue, 19 Aug 2025 14:31:59 -0700
Subject: [PATCH 24/25] add help text for min and max
---
.../coverage-and-quality/coverage-and-quality-report.html | 4 ++--
.../spinbutton/examples/css/quantity-spinbutton.css | 4 ++++
.../patterns/spinbutton/examples/quantity-spinbutton.html | 6 ++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/content/about/coverage-and-quality/coverage-and-quality-report.html b/content/about/coverage-and-quality/coverage-and-quality-report.html
index aa53c9b019..60e342bfe6 100644
--- a/content/about/coverage-and-quality/coverage-and-quality-report.html
+++ b/content/about/coverage-and-quality/coverage-and-quality-report.html
@@ -1992,9 +1992,9 @@