- The below example section includes a slider for setting a price range that demonstrates the
- multi-thumb slider design pattern.
- Users set a price range by moving the arrows (thumbs).
- Each slider has two thumbs: one for the minimum price and one for the maximum price.
- The price labels at the ends of the slider update as their corresponding thumbs are moved.
-
-
Similar examples include:
-
-
- Horizontal Slider Examples:
- Demonstrates using three horizontally aligned single-thumb sliders to make a color picker.
-
+ The below example section includes a slider for setting a price range that demonstrates the
+ multi-thumb slider design pattern.
+ Users set a price range by moving the arrows (thumbs).
+ Each slider has two thumbs: one for the minimum price and one for the maximum price.
+ The price labels at the ends of the slider update as their corresponding thumbs are moved.
+
+
Similar examples include:
+
+
+ Horizontal Slider Examples:
+ Demonstrates using three horizontally aligned single-thumb sliders to make a color picker.
+
A border is placed around the entire multi-thumbslider when one of the elements within the slider receives focus.
+
The placement of the slider value above the thumb supports users with low vision by allow them to more easily view the value of the slider as they move the thumb.
+
The SVG rect element is used to encapsulate both the slider and slider value for the slider with keyboard focus.
+
The use SVG polygon, rect and text elements enables the thumb, focus ring, value and rail of the slider to adapt to operating system high contrast colors.
+
The CSS currentColor value for the fill and stroke properties of the thumb and slider is used to support the override colors in high contrast mode.
+
+
+
+
+
Keyboard Support
+
+
+
+
Key
+
Function
+
+
+
+
+
Right Arrow
+
Increases slider value one step.
+
+
+
Up Arrow
+
Increases slider value one step.
+
+
+
Left Arrow
+
Decreases slider value one step.
+
+
+
Down Arrow
+
Decreases slider value one step.
+
+
+
Page Up
+
Increases slider value multiple steps. In this slider, jumps ten steps.
+
+
+
Page Down
+
Decreases slider value multiple steps. In this slider, jumps ten steps.
+
+
+
Home
+
Sets slider to its minimum value.
+
+
+
End
+
Sets slider to its maximum value.
+
+
+
+
+
+
Role, Property, State, and Tabindex Attributes
+
+
+
+
Role
+
Attribute
+
Element
+
Usage
+
+
+
+
+
+ slider
+
+
+
+ img
+
+
+
+
Identifies the img element as a slider.
+
Set on the movable thumb because it is the operable element that receives focus and represents the slider value.
+
+
+
+
+
+
+ tabindex=0
+
+
+ img
+
+
Includes the slider thumb in the page tab sequence.
+
+
+
+
+ aria-valuemax=NUMBER
+
+
+ img
+
+
Specifies the maximum value of the slider.
+
+
+
+
+ aria-valuemin=NUMBER
+
+
+ img
+
+
Specifies the minimum value of the slider.
+
+
+
+
+ aria-valuenow=NUMBER
+
+
+ img
+
+
Indicates the current value of the slider.
+
+
+
+
+ aria-valuetext=DOLLAR AMOUNT
+
+
+ img
+
+
Indicates the current value of the slider in dollars using the $ character as a prefix.
+
+
+
+
+ aria-label=text
+
+
+ img
+
+
A label identifying the purpose of the slider, e.g., Hotel Minimum Price.
A border is placed around the entire multi-thumbslider when one of the elements within the slider receives focus.
+
A border is placed around the entire multi-thumb slider when one of the elements within the slider receives focus.
The placement of the slider value above the thumb supports users with low vision by allow them to more easily view the value of the slider as they move the thumb.
The SVG rect element is used to encapsulate both the slider and slider value for the slider with keyboard focus.
The use SVG polygon, rect and text elements enables the thumb, focus ring, value and rail of the slider to adapt to operating system high contrast colors.
- The below example section includes a slider for setting a price range that demonstrates the
+
+
WARNING! Users of touch-based assistive technologies may not be able to fully operate widgets that implement the slider pattern because APIs for capturing the necessary gestures and commands from assistive technologies are not yet available. Authors should fully test slider widgets using assistive technologies on primarily touch devices before considering incorporation into production systems.
+
+
The below example section includes a slider for setting a price range that demonstrates the
multi-thumb slider design pattern.
Users set a price range by moving the arrows (thumbs).
Each slider has two thumbs: one for the minimum price and one for the maximum price.
From a5b350e2a0484480fe165c0d5538ace7fa1a2b96 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Tue, 16 Feb 2021 17:08:14 -0600
Subject: [PATCH 06/35] updated value limit code
---
examples/slider/js/slider-multithumb.js | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/examples/slider/js/slider-multithumb.js b/examples/slider/js/slider-multithumb.js
index 6feb5d9a6f..c590fad36d 100644
--- a/examples/slider/js/slider-multithumb.js
+++ b/examples/slider/js/slider-multithumb.js
@@ -170,13 +170,7 @@ class SliderMultithumb {
valueMax = this.getValueMax(this.maxSliderNode);
}
- if (value > valueMax) {
- value = valueMax;
- }
-
- if (value < valueMin) {
- value = valueMin;
- }
+ value = Math.min(Math.max(value, valueMin), valueMax);
var dollarValue = '$' + value;
sliderNode.setAttribute('aria-valuenow', value);
From 6358677eb3c20e3e62926d13fa74a2f12a2fb284 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Thu, 18 Feb 2021 13:31:23 -0600
Subject: [PATCH 07/35] added meta tag
---
examples/slider/slider-multithumb.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 050692c47d..332a26c9ee 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -2,6 +2,7 @@
+
Horizontal Multi-Thumb Slider Example | WAI-ARIA Authoring Practices 1.2
From 5e329ad6e559116d5b314d0c9a18a650add0ee07 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Wed, 24 Feb 2021 16:21:33 -0600
Subject: [PATCH 08/35] removed outer focus ring and updated documentation
---
examples/slider/css/slider-multithumb.css | 6 ------
examples/slider/js/slider-multithumb.js | 7 ++++---
examples/slider/slider-multithumb.html | 17 ++++++++++++-----
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/examples/slider/css/slider-multithumb.css b/examples/slider/css/slider-multithumb.css
index e05621af63..b11fa3a36d 100644
--- a/examples/slider/css/slider-multithumb.css
+++ b/examples/slider/css/slider-multithumb.css
@@ -6,12 +6,6 @@
touch-action: pan-y;
}
-.slider-multithumb.focus {
- padding: 4px;
- border: 2px solid #005a9c;
- border-radius: 5px;
-}
-
.slider-multithumb .slider-group .value {
font-size: 80%;
color: currentColor;
diff --git a/examples/slider/js/slider-multithumb.js b/examples/slider/js/slider-multithumb.js
index c590fad36d..59c79d7814 100644
--- a/examples/slider/js/slider-multithumb.js
+++ b/examples/slider/js/slider-multithumb.js
@@ -56,6 +56,7 @@ class SliderMultithumb {
this.focusY = this.valueTop - this.valueHeight - this.focusOffset + 2;
this.focusWidth = this.thumbWidth + 2 * this.focusOffset;
this.focusHeight = this.thumbBottom - this.focusY + this.focusOffset + 2;
+ this.focusRadius = this.focusWidth / 8;
this.svgNode.setAttribute('width', this.svgWidth);
this.svgNode.setAttribute('height', this.svgHeight);
@@ -66,8 +67,8 @@ class SliderMultithumb {
this.maxSliderFocusNode.setAttribute('width', this.focusWidth);
this.minSliderFocusNode.setAttribute('height', this.focusHeight);
this.maxSliderFocusNode.setAttribute('height', this.focusHeight);
- this.minSliderFocusNode.setAttribute('rx', this.focusWidth / 2);
- this.maxSliderFocusNode.setAttribute('rx', this.focusWidth / 2);
+ this.minSliderFocusNode.setAttribute('rx', this.focusRadius);
+ this.maxSliderFocusNode.setAttribute('rx', this.focusRadius);
this.minSliderValueNode.setAttribute('y', this.valueTop);
this.maxSliderValueNode.setAttribute('y', this.valueTop);
@@ -76,7 +77,7 @@ class SliderMultithumb {
this.railNode.setAttribute('x', this.railX);
this.railNode.setAttribute('height', this.railHeight);
this.railNode.setAttribute('width', this.railWidth + this.thumbWidth);
- this.railNode.setAttribute('rx', this.railHeight / 2);
+ this.railNode.setAttribute('rx', this.railHeight / 4);
this.sliderMinValue = this.getValueMin(this.minSliderNode);
this.sliderMaxValue = this.getValueMax(this.maxSliderNode);
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 332a26c9ee..18f4b38e87 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -122,11 +122,18 @@
Flight Price Range
Accessibility Features
-
A border is placed around the entire multi-thumb slider when one of the elements within the slider receives focus.
-
The placement of the slider value above the thumb supports users with low vision by allow them to more easily view the value of the slider as they move the thumb.
-
The SVG rect element is used to encapsulate both the slider and slider value for the slider with keyboard focus.
-
The use SVG polygon, rect and text elements enables the thumb, focus ring, value and rail of the slider to adapt to operating system high contrast colors.
-
The CSS currentColor value for the fill and stroke properties of the thumb and slider is used to support the override colors in high contrast mode.
+
+ The placement of the slider value above the thumb supports users with low vision by allow them to more easily view the value of the slider as the thumb is dragged.
+
+
+ The focus ring includes both the thumb and the slider value to make it easier to identify the thumb with the thumb value.
+
+
+ To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the SVG rect elements to synchronize the border color with text content. If specific colors are used to specify the stroke property, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if its color matches the high contrast mode background.
+
+
+ The use of pointer events supports assistive technologies on touch devices to change the value of slider using gestures.
+
From eae496616b37d3b0d24f95186379bdefa64fe653 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Thu, 25 Feb 2021 09:27:24 -0600
Subject: [PATCH 09/35] added documentation about using inline SVG
---
examples/slider/slider-multithumb.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 18f4b38e87..79674d20f2 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -129,7 +129,7 @@
Accessibility Features
The focus ring includes both the thumb and the slider value to make it easier to identify the thumb with the thumb value.
- To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the SVG rect elements to synchronize the border color with text content. If specific colors are used to specify the stroke property, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if its color matches the high contrast mode background.
+ To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the inline SVG rect elements to synchronize the border color with text content. If specific colors are used to specify the stroke property, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if its color matches the high contrast mode background. NOTE: The use of inline SVG graphics are needed to support the use of the currentColor value.
The use of pointer events supports assistive technologies on touch devices to change the value of slider using gestures.
From d0fc3a822c71b6faa31bd5edb81615fb75417a1c Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Tue, 2 Mar 2021 13:49:50 -0600
Subject: [PATCH 10/35] updated documentation and fill color of slider rail
---
examples/slider/css/slider-multithumb.css | 1 -
examples/slider/slider-multithumb.html | 9 +++------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/examples/slider/css/slider-multithumb.css b/examples/slider/css/slider-multithumb.css
index b11fa3a36d..8d4c0de88f 100644
--- a/examples/slider/css/slider-multithumb.css
+++ b/examples/slider/css/slider-multithumb.css
@@ -40,7 +40,6 @@
.slider-multithumb.focus .slider-group .rail {
stroke: currentColor;
- fill: #adddff;
}
.slider-multithumb [role="slider"]:focus {
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 79674d20f2..b265ea943d 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -123,16 +123,13 @@
Flight Price Range
Accessibility Features
- The placement of the slider value above the thumb supports users with low vision by allow them to more easily view the value of the slider as the thumb is dragged.
+ The placement of the slider value above the thumb makes it easier for users with low vision to see the current value while dragging the thumb.
- The focus ring includes both the thumb and the slider value to make it easier to identify the thumb with the thumb value.
+ To highlight the interactive nature of the thumb, the focus ring is drawn around the thumb and the value.
- To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the inline SVG rect elements to synchronize the border color with text content. If specific colors are used to specify the stroke property, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if its color matches the high contrast mode background. NOTE: The use of inline SVG graphics are needed to support the use of the currentColor value.
-
-
- The use of pointer events supports assistive technologies on touch devices to change the value of slider using gestures.
+ To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the SVG rect elements to synchronize the border color with text content. If specific colors were used to specify the stroke property, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background NOTE: SVGs must be inline to use currentColor.
To highlight the interactive nature of the thumb, the focus ring is drawn around the thumb and the value.
- To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the SVG rect elements to synchronize the border color with text content. If specific colors were used to specify the stroke property, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background NOTE: SVGs must be inline to use currentColor.
+ To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the SVG rect elements to synchronize the border color with text content. If specific colors were used to specify the stroke property, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background NOTE: SVG graphics must be inline to use currentColor.
From a1f39b1ad0fd1a97c97baa3436c924690715b2da Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Tue, 2 Mar 2021 16:44:54 -0600
Subject: [PATCH 13/35] fixed initial positioning of max slider value
---
examples/slider/js/slider-multithumb.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/examples/slider/js/slider-multithumb.js b/examples/slider/js/slider-multithumb.js
index 712dcd1db9..39b1bb43d3 100644
--- a/examples/slider/js/slider-multithumb.js
+++ b/examples/slider/js/slider-multithumb.js
@@ -117,7 +117,6 @@ class SliderMultithumb {
this.maxSliderNode.addEventListener('blur', this.onSliderBlur.bind(this));
this.moveSliderTo(this.minSliderNode, this.getValue(this.minSliderNode));
-
this.moveSliderTo(this.maxSliderNode, this.getValue(this.maxSliderNode));
}
@@ -206,6 +205,10 @@ class SliderMultithumb {
this.minSliderValueNode.setAttribute('x', pos);
this.minSliderRight = pos;
} else {
+ // update label and ARIA attributes
+ this.maxSliderValueNode.textContent = dollarValue;
+ this.minSliderNode.setAttribute('aria-valuemax', value);
+
// move the SVG focus ring and thumb elements
x = pos + this.thumbWidth - this.focusOffset + 1;
this.maxSliderFocusNode.setAttribute('x', x);
@@ -220,12 +223,9 @@ class SliderMultithumb {
if (pos - width < this.minSliderRight + 2) {
pos = this.minSliderRight + width + 2;
}
+
this.maxSliderValueNode.setAttribute('x', pos);
this.maxSliderLeft = pos;
-
- // update label and ARIA attributes
- this.maxSliderValueNode.textContent = dollarValue;
- this.minSliderNode.setAttribute('aria-valuemax', value);
}
}
From 3fd5d8a2db117379fcc71150236cfd8004a94126 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Wed, 3 Mar 2021 09:52:31 -0600
Subject: [PATCH 14/35] added range rect between min and max thumbs to visual
indicate the range of values
---
examples/slider/css/slider-multithumb.css | 12 ++++++++++--
examples/slider/js/slider-multithumb.js | 19 +++++++++++++++++++
examples/slider/slider-multithumb.html | 6 ++++++
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/examples/slider/css/slider-multithumb.css b/examples/slider/css/slider-multithumb.css
index f3654178e2..86bf8aae27 100644
--- a/examples/slider/css/slider-multithumb.css
+++ b/examples/slider/css/slider-multithumb.css
@@ -19,10 +19,15 @@
.slider-multithumb .slider-group .rail {
stroke: currentColor;
stroke-width: 2px;
- fill: #ddd;
+ fill: transparent;
opacity: 0.6;
}
+.slider-multithumb .slider-group .range {
+ fill: currentColor;
+ opacity: 0.5;
+}
+
.slider-multithumb .slider-group .thumb {
stroke: transparent;
stroke-width: 2px;
@@ -45,8 +50,11 @@
}
.slider-multithumb .slider-group.active g.rail {
+ opacity: 0.8;
+}
+
+.slider-multithumb .slider-group.active g.range {
fill: currentColor;
- opacity: 0.4;
}
.slider-multithumb [role="slider"]:focus {
diff --git a/examples/slider/js/slider-multithumb.js b/examples/slider/js/slider-multithumb.js
index 39b1bb43d3..89aa0d69a5 100644
--- a/examples/slider/js/slider-multithumb.js
+++ b/examples/slider/js/slider-multithumb.js
@@ -19,6 +19,7 @@ class SliderMultithumb {
this.svgPoint = this.svgNode.createSVGPoint();
this.railNode = domNode.querySelector('.rail rect');
+ this.rangeNode = domNode.querySelector('.range rect');
this.minSliderNode = domNode.querySelector('[role=slider].minimum');
this.maxSliderNode = domNode.querySelector('[role=slider].maximum');
@@ -79,6 +80,11 @@ class SliderMultithumb {
this.railNode.setAttribute('width', this.railWidth + this.thumbWidth);
this.railNode.setAttribute('rx', this.railHeight / 2);
+ this.rangeNode.setAttribute('y', this.railY);
+ this.rangeNode.setAttribute('x', this.railX / 2);
+ this.rangeNode.setAttribute('height', this.railHeight);
+ this.rangeNode.setAttribute('width', 0);
+
this.sliderMinValue = this.getValueMin(this.minSliderNode);
this.sliderMaxValue = this.getValueMax(this.maxSliderNode);
this.sliderDiffValue = this.sliderMaxValue - this.sliderMinValue;
@@ -154,6 +160,11 @@ class SliderMultithumb {
return value > valueMax || value < valueMin;
}
+ getXFromThumb(node) {
+ var points = node.getAttribute('points').split(',');
+ return parseInt(points[0]);
+ }
+
moveSliderTo(sliderNode, value) {
var valueMax,
valueMin,
@@ -227,6 +238,14 @@ class SliderMultithumb {
this.maxSliderValueNode.setAttribute('x', pos);
this.maxSliderLeft = pos;
}
+
+ // Set range rect
+
+ x = this.getXFromThumb(this.minSliderThumbNode) + this.thumbWidth / 2;
+ width =
+ this.getXFromThumb(this.maxSliderThumbNode) - x + this.thumbWidth / 2;
+ this.rangeNode.setAttribute('x', x);
+ this.rangeNode.setAttribute('width', width);
}
onSliderKeydown(event) {
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 8771195285..a051edc080 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -61,6 +61,9 @@
WARNING! Users of touch-based assistive technologies may not be able to fully operate widgets that implement the slider pattern because APIs for capturing the necessary gestures and commands from assistive technologies are not yet available. Authors should fully test slider widgets using assistive technologies on primarily touch devices before considering incorporation into production systems.
+
WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output. To change the slider value, touch-based assistive technologies need to respond to user gestures for incrementing and decrementing the value by synthesizing key events. This is a new convention that may not be fully implemented by some assistive technologies. Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
The below example section includes a slider for setting a price range that demonstrates the
multi-thumb slider design pattern.
From dbd98a201963d1749565923df3f3cd5ca72906cf Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Tue, 9 Mar 2021 19:10:41 -0600
Subject: [PATCH 16/35] updated example to remove flight price and use of
aria-valuetext
---
examples/index.html | 1 -
examples/slider/js/slider-multithumb.js | 6 +-
examples/slider/slider-multithumb.html | 64 +--
test/tests/slider_slider-multithumb.js | 542 +-----------------------
4 files changed, 10 insertions(+), 603 deletions(-)
diff --git a/examples/index.html b/examples/index.html
index f0195c1f64..a9f43fbc16 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -793,7 +793,6 @@
The below example section includes a slider for setting a price range that demonstrates the
multi-thumb slider design pattern.
Users set a price range by moving the arrows (thumbs).
- Each slider has two thumbs: one for the minimum price and one for the maximum price.
- The price labels at the ends of the slider update as their corresponding thumbs are moved.
+ The slider has two thumbs: one for the minimum price and one for the maximum price.
Similar examples include:
- Horizontal Slider Examples:
- Demonstrates using three horizontally aligned single-thumb sliders to make a color picker.
+ Horizontal Slider Examples:
+ Demonstrates using three horizontally aligned single-thumb sliders to make a color viewer.
To highlight the interactive nature of the thumb, the focus ring is drawn around the thumb and the value.
- To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke property is used for the SVG rect elements to synchronize the border color with text content. If specific colors were used to specify the stroke property, the color of these elements would remain the same in high contrast mode, which could lead to insufficient contrast between them and their background or even make them invisible if their color were to match the high contrast mode background NOTE: SVG graphics must be inline to use currentColor.
+ To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke and fill property is used for the inline SVG rect elements to synchronize the border color with text content. If specific colors are used to specify the stroke or fill property, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if its color matches the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust property set to the value auto for the currentColor value to be updated in high contrast modes, some browsers do not use auto for the default value. In addition, some browsers the SVG rect and polygon elements may need to adjust their stroke-opacity and fill-opacity values in place of using the transparent value for setting the fill and stroke colors in high contrast modes.
+ The use of the none role on the SVG element ensures assistive technologies do not interpret the SVG element as an image or some other role.
+
slider
- img
+ g
@@ -181,7 +192,7 @@
Role, Property, State, and Tabindex Attributes
tabindex=0
- img
+ g
Includes the slider thumb in the page tab sequence.
@@ -191,7 +202,7 @@
Role, Property, State, and Tabindex Attributes
aria-valuemax=NUMBER
- img
+ g
Specifies the maximum value of the slider.
@@ -201,7 +212,7 @@
Role, Property, State, and Tabindex Attributes
aria-valuemin=NUMBER
- img
+ g
Specifies the minimum value of the slider.
@@ -211,7 +222,7 @@
Role, Property, State, and Tabindex Attributes
aria-valuenow=NUMBER
- img
+ g
Indicates the current value of the slider.
@@ -221,10 +232,20 @@
Role, Property, State, and Tabindex Attributes
aria-label=text
- img
+ g
A label identifying the purpose of the slider, e.g., Hotel Minimum Price.
+
+
+
+ aria-hidden=true
+
+
+ g
+
+
Removes the SVG g element and it's children from the accessibility tree, since some screen readers will describe it as an image separate from the slider.
+
diff --git a/test/tests/slider_slider-multithumb.js b/test/tests/slider_slider-multithumb.js
index 356f5ccd16..fd123a667f 100644
--- a/test/tests/slider_slider-multithumb.js
+++ b/test/tests/slider_slider-multithumb.js
@@ -8,6 +8,9 @@ const exampleFile = 'slider/slider-multithumb.html';
const ex = {
sliderSelector: '#ex1 [role="slider"]',
+ svgSelector: '#ex1 svg',
+ railSelector: '#ex1 g.rail',
+ rangeSelector: '#ex1 g.range',
hotelSliderSelector: '#ex1 .slider-multithumb:nth-of-type(1) [role="slider"]',
hotelMin: '0',
hotelMax: '400',
@@ -43,6 +46,28 @@ const verifyAllValues = async function (
// Attributes
+ariaTest('role="none" on SVG element', exampleFile, 'svg-none', async (t) => {
+ await assertAriaRoles(t, 'ex1', 'none', '1', 'svg');
+});
+
+ariaTest(
+ 'SVG g elements used for the rail have aria-hidden',
+ exampleFile,
+ 'aria-hidden-g',
+ async (t) => {
+ await assertAttributeValues(t, ex.railSelector, 'aria-hidden', 'true');
+ }
+);
+
+ariaTest(
+ 'SVG g elements used for the range have aria-hidden',
+ exampleFile,
+ 'aria-hidden-g',
+ async (t) => {
+ await assertAttributeValues(t, ex.rangeSelector, 'aria-hidden', 'true');
+ }
+);
+
ariaTest(
'role="slider" on div element',
exampleFile,
From c3f6165fd131322c311b11e76c5d4885941f02b4 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Thu, 22 Apr 2021 11:38:08 -0500
Subject: [PATCH 22/35] fixed some linting errors
---
.vnurc | 3 +++
examples/index.html | 2 ++
2 files changed, 5 insertions(+)
diff --git a/.vnurc b/.vnurc
index 4afaa5da84..a92b023dd8 100644
--- a/.vnurc
+++ b/.vnurc
@@ -12,3 +12,6 @@ Attribute “aria-posinset” not allowed on element “tr” at this point.
Attribute “aria-setsize” not allowed on element “tr” at this point.
# Ignoring role meter
Bad value “meter” for attribute “role” on element “div”.
+# https://github.com/validator/validator/issues/1096
+Bad value “none” for attribute “role” on element “svg”.
+Bad value “presentation” for attribute “role” on element “svg”.
diff --git a/examples/index.html b/examples/index.html
index a9f43fbc16..384c2b41e8 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -233,6 +233,7 @@
From 4a62955e92b621f6124f2b431c928c39e1a6c532 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Tue, 27 Apr 2021 15:44:59 -0500
Subject: [PATCH 23/35] updated color styling of rail and thumbs with focus
---
examples/slider/css/slider-multithumb.css | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/examples/slider/css/slider-multithumb.css b/examples/slider/css/slider-multithumb.css
index e33f945c80..cf04326028 100644
--- a/examples/slider/css/slider-multithumb.css
+++ b/examples/slider/css/slider-multithumb.css
@@ -11,7 +11,7 @@
}
.slider-multithumb .slider-group {
- color: #005a9c;
+ color: black;
}
.slider-multithumb .slider-group .value {
@@ -60,11 +60,12 @@
fill-opacity: 1;
}
-.slider-multithumb [role="slider"]:focus {
+.slider-multithumb .slider-group [role="slider"]:focus {
outline: none;
+ color: #005a9c;
}
-.slider-multithumb [role="slider"]:hover .focus-ring {
+.slider-multithumb .slider-group [role="slider"]:hover .focus-ring {
stroke: currentColor;
stroke-width: 1px;
stroke-opacity: 0.8;
From 4b612c6438d453892b49c14e802e93a6a958dce4 Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Tue, 27 Apr 2021 15:52:08 -0500
Subject: [PATCH 24/35] updated color styling of rail and thumbs with focus to
match other slider examples
---
examples/slider/css/slider-multithumb.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/slider/css/slider-multithumb.css b/examples/slider/css/slider-multithumb.css
index cf04326028..2e2ab65bf8 100644
--- a/examples/slider/css/slider-multithumb.css
+++ b/examples/slider/css/slider-multithumb.css
@@ -56,7 +56,7 @@
}
.slider-multithumb .slider-group.active g.range {
- fill: currentColor;
+ fill: #005a9c;
fill-opacity: 1;
}
From 3861e97eff48ae17421de7590c93066b49683d2f Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Tue, 4 May 2021 14:29:06 -0500
Subject: [PATCH 25/35] updated label for sliders and accessibility
documentation
---
.husky/_/husky.sh | 30 ++++++++++++++++++++++++++
examples/slider/slider-multithumb.html | 6 +++---
2 files changed, 33 insertions(+), 3 deletions(-)
create mode 100644 .husky/_/husky.sh
diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh
new file mode 100644
index 0000000000..ca2720e08a
--- /dev/null
+++ b/.husky/_/husky.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+if [ -z "$husky_skip_init" ]; then
+ debug () {
+ [ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
+ }
+
+ readonly hook_name="$(basename "$0")"
+ debug "starting $hook_name..."
+
+ if [ "$HUSKY" = "0" ]; then
+ debug "HUSKY env variable is set to 0, skipping hook"
+ exit 0
+ fi
+
+ if [ -f ~/.huskyrc ]; then
+ debug "sourcing ~/.huskyrc"
+ . ~/.huskyrc
+ fi
+
+ export readonly husky_skip_init=1
+ sh -e "$0" "$@"
+ exitCode="$?"
+
+ if [ $exitCode != 0 ]; then
+ echo "husky - $hook_name hook exited with code $exitCode (error)"
+ exit $exitCode
+ fi
+
+ exit 0
+fi
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 596dbdf573..d00cb5c8cd 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -65,7 +65,7 @@
Hotel Price Range (in USD)
aria-valuemin="0"
aria-valuenow="100"
aria-valuemax="250"
- aria-label="Hotel Minimum Price">
+ aria-label="Hotel Minimum Price in US dollars">
0
@@ -76,7 +76,7 @@
Hotel Price Range (in USD)
aria-valuemin="100"
aria-valuenow="250"
aria-valuemax="400"
- aria-label="Hotel Maximum Price">
+ aria-label="Hotel Maximum Price in US dollars">
0
@@ -91,7 +91,7 @@
Hotel Price Range (in USD)
Accessibility Features
- The placement of the slider value above the thumb makes it easier for users with low vision to see the current value while dragging the thumb.
+ The current value of the slider is visible above the thumb, so when the thumb value is changed using a pointing device by a person with the visual impairment they can immediately see the change in value without have to move their visual attention to another part of the page.
To highlight the interactive nature of the thumb, the focus ring is drawn around the thumb and the value.
From e255ab36434115381d1f47463d1c0eeb6a4ede2e Mon Sep 17 00:00:00 2001
From: Jon Gunderson
Date: Wed, 12 May 2021 13:00:43 -0500
Subject: [PATCH 26/35] updated accessibility documentation on using
fill-opacity
---
examples/slider/slider-multithumb.html | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index d00cb5c8cd..9f2242cff1 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -97,8 +97,11 @@
Accessibility Features
To highlight the interactive nature of the thumb, the focus ring is drawn around the thumb and the value.
- To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the CSS currentColor value for the stroke and fill property is used for the inline SVG rect elements to synchronize the border color with text content. If specific colors are used to specify the stroke or fill property, these colors will remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if its color matches the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust property set to the value auto for the currentColor value to be updated in high contrast modes, some browsers do not use auto for the default value. In addition, some browsers the SVG rect and polygon elements may need to adjust their stroke-opacity and fill-opacity values in place of using the transparent value for setting the fill and stroke colors in high contrast modes.
+ To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the color of the borders are synchronized with the color of the text content.
+ For example, support for using the high contrast foreground color for the focus ring border is achieved by using the CSS currentColor value for the stroke property of an inline SVG rect element. To enable the high contrast background color to be the used as the contrasting color the fill-opacity attribute of the rect is set to zero.
+ If specific colors were instead used to specify the stroke and fill properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust property set to auto for the currentColor value to be updated in high contrast mode.
+ Some browsers do not use auto for the default value.
From 0435eff8b1ec491cb5b61523b956e60a7da2635d Mon Sep 17 00:00:00 2001
From: Matt King
Date: Mon, 24 May 2021 21:22:05 -0700
Subject: [PATCH 27/35] Update warning language to match other slider examples
---
examples/slider/slider-multithumb.html | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 9f2242cff1..ce877d51cd 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -26,7 +26,12 @@
Horizontal Multi-Thumb Slider Example
-
WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output. To change the slider value, touch-based assistive technologies need to respond to user gestures for incrementing and decrementing the value by synthesizing key events. This is a new convention that may not be fully implemented by some assistive technologies. Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
+ WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output.
+ To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events.
+ This is a new convention that may not be fully implemented by some assistive technologies.
+ Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
+
The below example section includes a slider for setting a price range that demonstrates the
multi-thumb slider design pattern.
From be2affe0b6f19dcd49f942d946c112784032b681 Mon Sep 17 00:00:00 2001
From: Matt King
Date: Mon, 24 May 2021 21:46:39 -0700
Subject: [PATCH 28/35] Simplify intro
---
examples/slider/slider-multithumb.html | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index ce877d51cd..319975c846 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -33,10 +33,11 @@
Horizontal Multi-Thumb Slider Example
Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
-
The below example section includes a slider for setting a price range that demonstrates the
- multi-thumb slider design pattern.
- Users set a price range by moving the arrows (thumbs).
- The slider has two thumbs: one for the minimum price and one for the maximum price.
+
+ The following example of the
+ multi-thumb slider design pattern
+ demonstrates an input for setting a pair of values that represent a range.
+ This example enables users to specify a price range for a hotel reservation by moving the two arrows (thumbs) that represent the minimum and maximum price.
Similar examples include:
From 80128b2aeb38ef64f601d83894052fc0a977e553 Mon Sep 17 00:00:00 2001
From: Matt King
Date: Mon, 24 May 2021 21:51:34 -0700
Subject: [PATCH 29/35] Update list of similar examples
---
examples/slider/slider-multithumb.html | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 319975c846..57a0fe6452 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -41,15 +41,11 @@
Horizontal Multi-Thumb Slider Example
Similar examples include:
-
- Horizontal Slider Examples:
- Demonstrates using three horizontally aligned single-thumb sliders to make a color viewer.
-
Color Viewer Slider Example: Basic horizontal sliders that illustrate setting numeric values for a color picker.
+
Vertical Temperature Slider Example: Demonstrates using aria-orientation to specify vertical orientation and aria-valuetext to communicate unit of measure for a temperature input.
+
Rating Slider Example: Horizontal slider that demonstrates using aria-valuetext to communicate current and maximum value of a rating input for a five star rating scale.
+
Example
From 9c0bfd0bbc2cb84b01c142999609f4fea342c669 Mon Sep 17 00:00:00 2001
From: Matt King
Date: Mon, 24 May 2021 21:58:34 -0700
Subject: [PATCH 30/35] Update wording of accessibility features documentation
to match latest wording from other examples
---
examples/slider/slider-multithumb.html | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index 57a0fe6452..c6cc9e7e59 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -92,19 +92,16 @@
Hotel Price Range (in USD)
Accessibility Features
+
The display of the slider's current value remains adjacent to the thumb as the thumb is moved, so people with a small field of view (e.g., due to magnification) can easily see the value while focusing on the thumb as they move it.
+
To highlight the interactive nature of the thumb, the focus ring is drawn around the thumb and the value.
- The current value of the slider is visible above the thumb, so when the thumb value is changed using a pointing device by a person with the visual impairment they can immediately see the change in value without have to move their visual attention to another part of the page.
-
-
- To highlight the interactive nature of the thumb, the focus ring is drawn around the thumb and the value.
-
-
- To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the color of the borders are synchronized with the color of the text content.
- For example, support for using the high contrast foreground color for the focus ring border is achieved by using the CSS currentColor value for the stroke property of an inline SVG rect element. To enable the high contrast background color to be the used as the contrasting color the fill-opacity attribute of the rect is set to zero.
- If specific colors were instead used to specify the stroke and fill properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
- Note: The SVG element needs to have the CSS forced-color-adjust property set to auto for the currentColor value to be updated in high contrast mode.
+ To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the color of the borders are synchronized with the color of the text content.
+ For example, the color of the focus ring border is set to match the foreground color of high contrast mode text by specifying the CSS currentColor value for the stroke property of the inline SVG rect element used to draw the focus ring border.
+ To make the background of the rect match the high contrast background color, the fill-opacity attribute of the rect is set to zero.
+ If specific colors were instead used to specify the stroke and fill properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
+ Note: The SVG element needs to have the CSS forced-color-adjust property set to auto for the currentColor value to be updated in high contrast mode.
Some browsers do not use auto for the default value.
-
+
From 1fe991f74ab49bbfc034ca3bc3310c1c6e14de5a Mon Sep 17 00:00:00 2001
From: Matt King
Date: Mon, 24 May 2021 22:06:09 -0700
Subject: [PATCH 31/35] Revise aria-hidden documentation
---
examples/slider/slider-multithumb.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index c6cc9e7e59..aeaa4a7363 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -246,11 +246,12 @@
Role, Property, State, and Tabindex Attributes
g
-
Removes the SVG g element and it's children from the accessibility tree, since some screen readers will describe it as an image separate from the slider.
+
Removes the SVG g element from the accessibility tree to prevent assistive technologies from presenting it as an image separate from the slider.
+
Javascript and CSS Source Code
From b866c6fce35d05d572026ce40007c74957a96e45 Mon Sep 17 00:00:00 2001
From: Matt King
Date: Mon, 24 May 2021 22:10:59 -0700
Subject: [PATCH 32/35] Make aria-hidden documentation in rating slider match
wording in seek and multi-thumb
---
examples/slider/slider-multithumb.html | 1 +
examples/slider/slider-rating.html | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/examples/slider/slider-multithumb.html b/examples/slider/slider-multithumb.html
index aeaa4a7363..80bed1101a 100644
--- a/examples/slider/slider-multithumb.html
+++ b/examples/slider/slider-multithumb.html
@@ -259,6 +259,7 @@
Color Viewer Slider Example: Basic horizontal sliders that illustrate setting numeric values for a color picker.
Vertical Temperature Slider Example: Demonstrates using aria-orientation to specify vertical orientation and aria-valuetext to communicate unit of measure for a temperature input.
Rating Slider Example: Horizontal slider that demonstrates using aria-valuetext to communicate current and maximum value of a rating input for a five star rating scale.
+
Media Seek Slider Example: Horizontal slider that demonstrates using aria-valuetext to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds.