Skip to content

Commit

Permalink
Multithumb Slider Example: Simplify and improve code quality (pull #1758
Browse files Browse the repository at this point in the history
)

This commit changes the multi-thumb slider to simplify the example page and improve code quality with the following changes:
1. To support high contrast, uses SVG for the slider controls.
2. Uses pointer events to add touch support.
3. Adds an accessibility feature section.
4. Updates code to implement latest APG coding practices, including using event.key , instead of event.keyCode.
6. Removes redundant flight price range multi-thumb slider.
7. Removes the use of aria-valuetext.

Co-authored-by: Matt King <[email protected]>
  • Loading branch information
jongund and mcking65 authored Aug 24, 2021
1 parent 937cfab commit 9e036d7
Show file tree
Hide file tree
Showing 11 changed files with 788 additions and 1,112 deletions.
30 changes: 30 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion aria-practices.html
Original file line number Diff line number Diff line change
Expand Up @@ -2432,7 +2432,7 @@ <h3>Slider (Multi-Thumb)</h3>

<section class="notoc">
<h4>Example</h4>
<p><a href="examples/slider/multithumb-slider.html">Multi-Thumb Slider Examples</a>: Demonstrates two-thumb sliders for picking price ranges for an airline flight and hotel reservation.</p>
<p><a href="examples/slider/slider-multithumb.html">Multi-Thumb Slider Examples</a>: Demonstrates a two-thumb slider for picking a price range for a hotel reservation.</p>
</section>

<section id="slidertwothumb_kbd_interaction" class="notoc">
Expand Down
6 changes: 0 additions & 6 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ <h2 id="examples_by_role_label">Examples by Role</h2>
<td><code>slider</code></td>
<td>
<ul>
<li><a href="slider/multithumb-slider.html">Horizontal Multi-Thumb Slider</a></li>
<li><a href="slider/slider-color-viewer.html">Color Viewer Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-rating.html">Rating Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-seek.html">Media Seek Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
Expand Down Expand Up @@ -628,7 +627,6 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<li><a href="link/link.html">Link</a></li>
<li><a href="menubar/menubar-editor.html">Editor Menubar</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="menubar/menubar-navigation.html">Navigation Menubar</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/multithumb-slider.html">Horizontal Multi-Thumb Slider</a></li>
<li><a href="spinbutton/datepicker-spinbuttons.html">Date Picker Spin Button</a></li>
<li><a href="table/table.html">Table</a></li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
Expand Down Expand Up @@ -814,7 +812,6 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<td>
<ul>
<li><a href="meter/meter.html">Meter</a></li>
<li><a href="slider/multithumb-slider.html">Horizontal Multi-Thumb Slider</a></li>
<li><a href="slider/slider-color-viewer.html">Color Viewer Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-rating.html">Rating Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-seek.html">Media Seek Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
Expand All @@ -829,7 +826,6 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<td>
<ul>
<li><a href="meter/meter.html">Meter</a></li>
<li><a href="slider/multithumb-slider.html">Horizontal Multi-Thumb Slider</a></li>
<li><a href="slider/slider-color-viewer.html">Color Viewer Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-rating.html">Rating Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-seek.html">Media Seek Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
Expand All @@ -844,7 +840,6 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<td>
<ul>
<li><a href="meter/meter.html">Meter</a></li>
<li><a href="slider/multithumb-slider.html">Horizontal Multi-Thumb Slider</a></li>
<li><a href="slider/slider-color-viewer.html">Color Viewer Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-rating.html">Rating Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-seek.html">Media Seek Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
Expand All @@ -858,7 +853,6 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<td><code>aria-valuetext</code></td>
<td>
<ul>
<li><a href="slider/multithumb-slider.html">Horizontal Multi-Thumb Slider</a></li>
<li><a href="slider/slider-rating.html">Rating Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-seek.html">Media Seek Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="slider/slider-temperature.html">Vertical Temperature Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
Expand Down
48 changes: 0 additions & 48 deletions examples/slider/css/multithumb-slider.css

This file was deleted.

88 changes: 88 additions & 0 deletions examples/slider/css/slider-multithumb.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* CSS Document */

.slider-multithumb {
padding: 6px;
width: 350px;
touch-action: pan-y;
}

.slider-multithumb svg {
forced-color-adjust: auto;
}

.slider-multithumb .slider-group {
color: black;
}

.slider-multithumb .slider-group .value {
font-size: 80%;
color: currentColor;
fill: currentColor;
}

.slider-multithumb .slider-group .rail {
stroke: currentColor;
stroke-width: 2px;
fill-opacity: 0;
}

.slider-multithumb .slider-group .range {
fill: currentColor;
opacity: 0.4;
}

.slider-multithumb .slider-group .thumb {
stroke-opacity: 0;
stroke-width: 2px;
fill: currentColor;
}

.slider-multithumb .slider-group .focus-ring {
stroke-opacity: 0;
fill-opacity: 0;
stroke-linecap: round;
stroke-linejoin: round;
}

/* Focus and hover styling */

.slider-multithumb .slider-group g.rail,
.slider-multithumb .slider-group g.focus {
color: currentColor;
}

.slider-multithumb .slider-group.active g.rail {
opacity: 0.8;
}

.slider-multithumb .slider-group.active g.range {
fill: #005a9c;
fill-opacity: 1;
}

.slider-multithumb [role="slider"]:focus {
outline: none;
color: #005a9c;
}

.slider-multithumb [role="slider"]:hover .focus-ring {
stroke: currentColor;
stroke-width: 1px;
stroke-opacity: 0.8;
}

.slider-multithumb [role="slider"]:hover .focus-ring,
.slider-multithumb [role="slider"]:focus .focus-ring {
stroke: currentColor;
stroke-opacity: 1;
stroke-width: 3px;
}

.slider-multithumb [role="slider"]:focus .thumb {
stroke: currentColor;
}

.slider-multithumb [role="slider"]:focus .value {
color: currentColor;
font-weight: bold;
}
Loading

0 comments on commit 9e036d7

Please sign in to comment.