WordPress.org

Make WordPress Core

Changeset 40479


Ignore:
Timestamp:
04/19/2017 07:53:00 PM (21 months ago)
Author:
afercia
Message:

Accessibility: Make Safari 10 + VoiceOver announce repeated, identical, wp.a11y.speak() messages.

Safari 10 + VoiceOver don't announce repeated, identical, strings sent to an
aria-live region. Appending a no-break space to a repeated message string,
forces them to think the strings are different.

Fixes #36853.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/wp-a11y.js

    r38115 r40479  
    55
    66    var $containerPolite,
    7         $containerAssertive;
     7        $containerAssertive,
     8        previousMessage = '';
    89
    910    /**
     
    2324        // Ensure only text is sent to screen readers.
    2425        message = $( '<p>' ).html( message ).text();
     26
     27        /*
     28         * Safari 10+VoiceOver don't announce repeated, identical strings. We use
     29         * a `no-break space` to force them to think identical strings are different.
     30         * See ticket #36853.
     31         */
     32        if ( previousMessage === message ) {
     33            message = message + '\u00A0';
     34        }
     35
     36        previousMessage = message;
    2537
    2638        if ( $containerAssertive && 'assertive' === ariaLive ) {
Note: See TracChangeset for help on using the changeset viewer.