-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Color Viewer Slider: Improve high contrast support, touch AT support,…
… and APG code quality guidelines support (#1746) Makes the following changes to the color viewer slider example: * Align with current APG code quality guidelines, including using a single object for the color viewer. * Use SVG graphic elements instead of HTML elements for the visual rendering. * Use currentColor value for SVG stroke property to support high contrast modes in operating systems. * Use event.key instead of event.keyCode for responding to keyboard events, which also provides support for iOS and Android screen readers. * Updated focus styling to have a ring around the thumb. * Use pointer events instead of mouse events, which provides support for moving the slider thumb with touch. * Added group role and accessible name for the color viewer widget. Co-authored-by: Matt King <a11yThinker@gmail.com>
- Loading branch information
Showing
8 changed files
with
925 additions
and
653 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* CSS Document */ | ||
|
||
.color-viewer-sliders label { | ||
display: block; | ||
} | ||
|
||
.color-viewer-sliders .color-box { | ||
width: 200px; | ||
height: 200px; | ||
border: black solid medium; | ||
text-align: center; | ||
padding: 0.25em; | ||
forced-color-adjust: none; | ||
} | ||
|
||
.color-viewer-sliders .color-info { | ||
padding-top: 5px; | ||
} | ||
|
||
.color-viewer-sliders .color-info label { | ||
margin-top: 0.25em; | ||
display: block; | ||
} | ||
|
||
.color-slider { | ||
margin: 0; | ||
margin-bottom: 1em; | ||
padding: 2px; | ||
touch-action: pan-y; | ||
width: 350px; | ||
outline: none; | ||
} | ||
|
||
.color-slider div, | ||
.color-slider svg { | ||
display: block; | ||
width: 350px; | ||
} | ||
|
||
.color-slider-label { | ||
margin: 0; | ||
padding: 0; | ||
font-weight: bold; | ||
} | ||
|
||
.color-slider .value { | ||
color: currentColor; | ||
fill: currentColor; | ||
} | ||
|
||
.color-slider .valueBackground { | ||
fill: white; | ||
stroke-width: 0; | ||
} | ||
|
||
.color-slider .rail { | ||
fill: #bbb; | ||
stroke: currentColor; | ||
stroke-width: 2px; | ||
opacity: 0.8; | ||
} | ||
|
||
.color-slider .fill { | ||
stroke-width: 0; | ||
opacity: 0.5; | ||
pointer-events: none; | ||
} | ||
|
||
.color-slider.red .fill { | ||
fill: red; | ||
} | ||
|
||
.color-slider.green .fill { | ||
fill: green; | ||
} | ||
|
||
.color-slider.blue .fill { | ||
fill: blue; | ||
} | ||
|
||
.color-slider .thumb { | ||
fill: #666; | ||
stroke: currentColor; | ||
stroke-width: 2px; | ||
} | ||
|
||
.color-slider .focus { | ||
fill: transparent; | ||
stroke: transparent; | ||
stroke-width: 2px; | ||
} | ||
|
||
.color-slider:focus .value, | ||
.color-slider:hover .value { | ||
font-weight: bold; | ||
} | ||
|
||
.color-slider:focus .fill, | ||
.color-slider:hover .fill { | ||
opacity: 1; | ||
} | ||
|
||
.color-slider:focus .rail, | ||
.color-slider:hover .rail { | ||
fill: transparent; | ||
stroke: currentColor; | ||
opacity: 1; | ||
} | ||
|
||
.color-slider:focus .thumb, | ||
.color-slider:hover .thumb { | ||
fill: #ddd; | ||
stroke: currentColor; | ||
opacity: 1; | ||
} | ||
|
||
.color-slider:focus .focus, | ||
.color-slider:hover .focus { | ||
stroke: currentColor; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.