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 all 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
6 changes: 6 additions & 0 deletions modules/shortcodes/js/slideshow-shortcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,14 @@ JetpackSlideshow.prototype.renderControls_ = function() {
var controls = [ 'prev', 'stop', 'next' ];
for ( var i = 0; i < controls.length; i++ ) {
var controlName = controls[ i ];
var label_name = 'label_' + controlName;
var a = document.createElement( 'a' );

a.href = '#';
a.className = 'button-' + controlName;
a.setAttribute( 'aria-label', jetpackSlideshowSettings[ label_name ] );
a.setAttribute( 'role', 'button' );

controlsDiv.appendChild( a );
this.controls[ controlName ] = a;
}
Expand Down
14 changes: 10 additions & 4 deletions modules/shortcodes/slideshow.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,20 @@ 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 - label_prev - Aria label for slideshow's previous button
* - string - label_stop - 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',
'label_prev' => __( 'Previous Slide', 'jetpack' ),
'label_stop' => __( 'Pause Slideshow', 'jetpack' ),
'label_next' => __( 'Next Slide', 'jetpack' ),
)
)
);
Expand Down