WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 2 days ago

#47147 new defect (bug)

Status message not exposed to assistive technologies

Reported by: anevins Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-screenshots needs-patch wpcampus-report
Focuses: ui, accessibility Cc:

Description (last modified by afercia)

Moved from the WPCampus accessibility report issues on GitHub, see: https://github.com/WordPress/gutenberg/issues/15293

  • Severity:
    • Medium
  • Affected Populations:
    • Blind
    • Low-Vision
    • Cognitively Impaired
  • Platform(s):
    • Windows - Screen Reader
    • Mac - VoiceOver
    • Android - TalkBack
    • iOS - VoiceOver
  • Components affected:
    • Edit Media

Issue description
Within the Edit Media page, when activating the "Restore Image"
button, a message is shown above the image while the Restore button
itself disappears.

Since the button would have been focused at the time when activated by
keyboard, this causes the keyboard focus position to be lost and reset
to the top of the page.

The message itself is also not announced by screen readers, and may not
be visible to screen magnification users if it appears outside their
current view.

Issue Code

    <div class="imgedit-panel-content wp-clearfix">


        <div class="error">


            <p>Cannot save image metadata.</p>


        </div>


        <div class="imgedit-menu wp-clearfix">


            ...


        </div>


    </div>





    ...





    <div class="imgedit-panel-content wp-clearfix">


        <div class="updated">


            <p>Image restored successfully.</p>


        </div>


        <div class="imgedit-menu wp-clearfix">


            ...


        </div>


    </div>

Remediation Guidance
Add tabindex="-1" to the message, and then programatically focus
it when it appears. This will maintain a logical focus position, and
ensure that all visual users will see it, while assistive technologies
announce it.

Adding the alert role will also help to convey to screen readers
that this is an alert-type message.

Recommended Code

    <div class="imgedit-panel-content wp-clearfix">


        <div class="error" tabindex="-1" role="alert">


            <p>Cannot save image metadata.</p>


        </div>


        <div class="imgedit-menu wp-clearfix">


            ...


        </div>


    </div>





    ...





    <div class="imgedit-panel-content wp-clearfix">


        <div class="updated" tabindex="-1" role="alert">


            <p>Image restored successfully.</p>


        </div>


        <div class="imgedit-menu wp-clearfix">


            ...


        </div>


    </div>

Relevant standards

  • 2.1.1 Keyboard (Level A)

Note: This issue may be a duplicate with other existing accessibility-related bugs in this project. This issue comes from the Gutenberg accessibility audit, performed by Tenon and funded by WP Campus. This issue is GUT-73 in Tenon's report

Attachments (1)

57186829-bc9dfc00-6e9a-11e9-99be-b0975c99aea6.png (448.6 KB) - added by anevins 6 weeks ago.

Download all attachments as: .zip

Change History (8)

#1 @afercia
6 weeks ago

  • Description modified (diff)

#2 @afercia
6 weeks ago

Worth noting this applies only to notifications that are dynamically added in a page. Instead, the standard "admin notices" rendered on page load, wouldn't benefit from a role=alert or role=status. See #47111 and #46995.

#3 @afercia
5 weeks ago

  • Milestone changed from Awaiting Review to 5.3

#4 @afercia
6 days ago

Related: #47111.

This ticket was mentioned in Slack in #core-media by anevins. View the logs.


3 days ago

#6 @anevins
3 days ago

@afercia it seems that we're talking about 2 things;
1) Moving the keyboard focus from the "Restore Image" button which disappears visually;
2) Putting alert roles or status on the notifications

If there's a way to tie into the functionality that hides the submit button, that would be easiest for the focus handling bit

jQuery('.submit').on('click', function() {
   $(this).hide();
   $('.notification').attr('tabindex', '-1').focus();
});

#7 @afercia
2 days ago

@anevins it's indeed two issues.

Currently, when pressing "Restore Image", focus is moved to the first focusable element within the image editor container which is... the "Scale image" help button:

http://cldup.com/w-mQVVimC3.png

Worth reminding the media editor is used also within the media modal:

http://cldup.com/NC6NLEkK66.png

Not ideal, can be certainly changed but the image editor code is pretty old and moving focus to the first focusable element seemed a good idea. In the case of notices appearing in the page, it should behave as suggested above. However, I'd tend to think we should favor a generalic, reusable, solution rather than ad-hoc implementations.

Relevant code is in src/js/_enqueues/lib/image-edit.js.

The second issue are the status notices that appear on the page. Instead of using a role=alert, I'd recommend to use wp.a11y.speak() which is the core implementation of ARIA live regions. Passing the assertive parameter to speak() would produce the equivalent announcement of an ARIA alert.

Note: See TracTickets for help on using tickets.