Here I am, your beloved popup!

Glafira Zhur

Here I am, your
beloved popup!

Dead mouse
glafira zhur

Glafira Zhur

Frontend Developer at 

Twitter: @GlafiraZhur


Program committee member:
@MinskCSS и @MinskJS, @a11yminsk

Story

Dead mouse
Dead mouse The Sak
Dead mouse
Dead mouse
Dead mouse
Dead mouse
Dead mouse
Dead mouse
Dead mouse

Let's help
the popup!

Dasha the traveler
Dialog

Dialog

Dialog Dialog modal
Dialog
Dialog
Dialog
Dialog
Dialog
Dialog

Modal Dialog

Dialog

Modal Window Structure

Dialog

<dialog>
tag

dialog spec
Dialog Can I Use

HTML

Modal Window - HTML

Let's add
a little bit of A11Y

Dialog

Close Button (now)

  
    <button>X</button>
  

Hide an icon from a Screen Reader

  
    <button>
      <span aria-hidden="true">X</span>
    </button>
  

Add a label to the button

  
    <button>
      <span aria-hidden="true">X</span>
      <span class="visually-hidden">Close modal</span>
    </button>
  

Modal Window - Role

  
  <div class="modal">
    ...
  </div>
  

Modal Window - Role

  
  <div class="modal" role="dialog">
    ...
  </div>
  

Header and Footer


    <div class="modal__header">
      <h2>Modal Window Heading</h2>
    </div>
        ...
    <div class="modal__footer">
      <!-- buttons/actions -->
    </div>
      
axe error axe extension

Don't do this!

Cross

axe validation errors

axe error axe extension

Don't do this too!

Cross

axe validation errors

axe error axe extension

Valid Case

Modal Window - Heading

  
  <div class="modal" role="dialog">
    <div class="modal__header">
      <h2>Modal Window Heading</h2>
    </div>
    ...
  </div>
  

Modal Window - Heading

Modal Window - Heading

Modal Window - Type

Modal Window - Type

The HTML and A11Y check-list

Behavior

Set focus to the Close button

Dialog

Make a Focus Trap

Dialog

Close the Modal Window

Dialog

Set focus to the opening element

Dialog

How to hide the modal?

  
    .hidden {
      display: none;
    }
  

The Behaviour check-list

#StayHome

Conclusions

Let's see what's changed

NOTHING

Dialog

NOTHING

Dialog

NOTHING

Dialog

Useful links

  1. W3C WAI-ARIA practices - Modal Dialog Example
  2. Dialog HTML specification
  3. How to test the #a11y (Twitter)

Thank you!