Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #27649 from eeejay/bug-1069004
Browse files Browse the repository at this point in the history
Bug 1069004 - Make brightness slider accessible. r=pdahiya
  • Loading branch information
eeejay committed Feb 19, 2015
2 parents 26b21d3 + c69bfc3 commit 1c2fb4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/gallery/index.html
Expand Up @@ -193,7 +193,7 @@ <h1 id="edit-title" data-l10n-id="edit"></h1>
<!-- this holds different options for different editing modes -->
<!-- only one set of options will be visible at a time -->
<div id="edit-options">
<div id="exposure-slider" class="edit-options-bar hidden">
<div id="exposure-slider" class="edit-options-bar hidden" role="slider" aria-valuemax="3" aria-valuemin="-3" aria-valuenow="0">
<div id="sliderbar">
<hr id="sliderline"/>
<div id="sliderthumb"></div>
Expand Down
11 changes: 11 additions & 0 deletions apps/gallery/js/ImageEditor.js
Expand Up @@ -230,6 +230,14 @@ var exposureSlider = (function() {
thumb.addEventListener('touchend', function(e) {
thumb.classList.remove('active');
});
slider.addEventListener('keypress', function(e) {
// screen reader sends key arrow up/down events for adjusting the slider.
if (e.keyCode == KeyEvent.DOM_VK_DOWN) {
setExposure(currentExposure - 0.25);
} else if (e.keyCode == KeyEvent.DOM_VK_UP) {
setExposure(currentExposure + 0.25);
}
});

function resize() {
forceSetExposure(currentExposure);
Expand Down Expand Up @@ -281,6 +289,9 @@ var exposureSlider = (function() {
// Remember the new exposure value
currentExposure = exposure;

// Set value for ARIA widget
slider.setAttribute('aria-valuenow', exposure);

// Dispatch an event to actually change the image
slider.dispatchEvent(new Event('change', {bubbles: true}));
}
Expand Down

0 comments on commit 1c2fb4e

Please sign in to comment.