Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slideshow Shortcode: Add labels to navigation buttons for accessibility #13739

Merged
merged 6 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions modules/shortcodes/js/slideshow-shortcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ JetpackSlideshow.prototype.renderControls_ = function() {
var controlName = controls[ i ];
var a = document.createElement( 'a' );
a.href = '#';
switch ( i ) {
case 0:
a.className = jetpackSlideshowSettings.class_prev;
a.setAttribute( 'aria-label', jetpackSlideshowSettings.label_prev );
break;

case 1:
a.className = jetpackSlideshowSettings.class_pause;
a.setAttribute( 'aria-label', jetpackSlideshowSettings.label_pause );
break;

case 2:
a.className = jetpackSlideshowSettings.class_next;
a.setAttribute( 'aria-label', jetpackSlideshowSettings.label_next );
break;
}
a.setAttribute( 'role', 'button' );
controlsDiv.appendChild( a );
this.controls[ controlName ] = a;
}
Expand Down
20 changes: 16 additions & 4 deletions modules/shortcodes/slideshow.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,26 @@ public function enqueue_scripts() {
* @since 4.7.0 Added the `speed` option to the array of options.
*
* @param array $args
* - string - spinner - URL of the spinner image.
* - string - speed - Speed of the slideshow. Defaults to 4000.
* - string - spinner - URL of the spinner image.
* - string - speed - Speed of the slideshow. Defaults to 4000.
* - string - class_prev - CSS class for slideshow's previous button
* - string - class_pause - CSS class for slideshow's pause button
* - string - class_next - CSS class for slideshow's next button
jeherve marked this conversation as resolved.
Show resolved Hide resolved
* - string - label_prev - Aria label for slideshow's previous button
* - string - label_pause - Aria label for slideshow's pause button
* - string - label_next - Aria label for slideshow's next button
*/
apply_filters(
'jetpack_js_slideshow_settings',
array(
'spinner' => plugins_url( '/img/slideshow-loader.gif', __FILE__ ),
'speed' => '4000',
'spinner' => plugins_url( '/img/slideshow-loader.gif', __FILE__ ),
'speed' => '4000',
'class_prev' => 'classic-jetpack-slideshow_button-previous',
'class_pause' => 'classic-jetpack-slideshow_button-pause',
'class_next' => 'classic-jetpack-slideshow_button-next',
jeherve marked this conversation as resolved.
Show resolved Hide resolved
'label_prev' => 'Previous Slide',
jeherve marked this conversation as resolved.
Show resolved Hide resolved
'label_pause' => 'Pause Slideshow',
'label_next' => 'Next Slide',
)
)
);
Expand Down