dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.38k stars 3.5k forks source link

Improve support for Accessibility and ARIA #23

Open ianthedev opened 11 years ago

ianthedev commented 11 years ago

Currently the plugin doesn't have some important Accessibility and ARIA features:



  1. http://www.w3.org/TR/wai-aria/states_and_properties#attrs_liveregions
  2. http://jqueryui.com/resources/demos/dialog/modal-form.html
dimsemenov commented 11 years ago

Thank you, however I've got a few questions regarding this:

Using ARIA live region [1] semantics to allow users of assistive technologies to be aware of the new content if the lightbox is launched without explicit user action.

Please explain what exactly attributes must be added to which elements and at which state.

Using ARIA attributes such as role="dialog", aria-describedby, and aria-labelledby to better identify and label the lightbox. Please refer to jQuery UI's modal implementation. [2]

This should be defined by a developer, as Magnific doesn't control the markup of a popup itself. http://dimsemenov.com/plugins/magnific-popup/documentation.html#inline_type

Tab-able elements outside of the lightbox should be suppressed from the tab order until the lightbox is closed.

This is already implemented.

The Home key should take users to the first slide. And the End key should take users to the last slide.

Will be done.

ianthedev commented 11 years ago

Please explain what exactly attributes must be added to which elements and at which state.

For example, if the lightbox is launched automatically on page load, aria-live="polite" need to be added to the container element so screen reader users can be notified of the popup content. Otherwise screen reader users will get confused.

This should be defined by a developer, as Magnific doesn't control the markup of a popup itself.

Not all developers know how to use ARIA, so the plugin should do it. jQuery UI does it for developers.

This is already implemented.

Nice. Could you ensure it has been implemented on the homepage of the plugin?


Also, as mentioned in a previous thread, please ensure the example has been implemented. Thanks.

ianthedev commented 11 years ago

Well, maybe the first one is not needed because there won't seem to be any use case for this plugin. I had deleted it.

peterkuma commented 10 years ago

I noticed a few more problems regarding accessibility:

  <button title="%title%" type="button" class="mfp-close" aria-label="%title%">
    <span aria-hidden="true">&times;</span>
  </button>

I can post some pull requests. Edit: #423, #424, #425

davidpustai commented 8 years ago

:+1:

DylannCordel commented 8 years ago

:+1:

HazardCreative commented 3 years ago

I think the wrap element should indeed have a role="dialog". See WAI-ARIA 1.0 Authoring Practices or The Incredible Accessible Modal Window, Version 2.

I added the below to my initialization to resolve the above:

callbacks: {
    open: function() {
        magnificPopup.wrap.attr('role', 'dialog');
    }
}

However, this is not sufficient on its own as you must also supply a label with this type. magnificPopup.wrap.attr('aria-label', '[label]') is sometimes sufficient but often you will need to program something dynamic.