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

Improve the slide dot markup and behavior #10

Closed
12 tasks done
jasonwebb opened this issue Aug 16, 2020 · 0 comments
Closed
12 tasks done

Improve the slide dot markup and behavior #10

jasonwebb opened this issue Aug 16, 2020 · 0 comments
Labels
feature change Change to an existing feature or functionality

Comments

@jasonwebb
Copy link

jasonwebb commented Aug 16, 2020

The most important change that needs to be made is that all tab-related markup and behaviors needs to be removed, since carousels do not visually resemble tabs at all and therefore would not be expected to function that way by real sighted keyboard and screen reader users.

Wrapper and structural elements

  • Remove role="tablist" from the wrapper <ul>.
  • Remove role="presentation" from the <li>s.

Each slide dot button

  • Remove role="tab" from each slide dot button.
  • Remove aria-controls from each slide dot button.
  • Remove tabindex from each button, since a roving tabindex is not appropriate for carousels.
  • Remove aria-selected from the active slide dot button.
  • Add aria-current="true" to the button that is currently "active".
  • Move the icon to an inner DOM element so that it can be hidden from screen readers using aria-hidden="true".
  • Wrap the inner text in a <span> and apply CSS to make it visible to screen readers only.
  • Update the inner text of each button to use the format "Go to slide [x]" to make it more clear that these are actionable controls, not slides in themselves.
  • Remove the aria-label from each slide dot button once the above changes are made, since the inner text will act as a more robust accessible name (see the First Rule of ARIA Use).

Documentation

  • Add note about feature change in the main README

Currently the buttons and their wrapper list are marked up like so:

<ul class="slide-dots" role="tablist">
  <li class="slick-active" role="presentation">
    <button type="button" role="tab" id="slick-slide-control00" aria-controls="slick-slide00" aria-label="1 of 6" tabindex="0" aria-selected="true">
      :before
      1
    </button>
  </li>
  <li role="presentation">
    <button type="button" role="tab" id="slick-slide-control01" aria-controls="slick-slide02" aria-label="2 of 6" tabindex="-1">
      :before
      2
    </button>
  </li>
  ...
</ul>

When what we really want is:

<ul class="slide-dots">
  <li class="slick-active">
    <button type="button" id="slick-slide-control00" aria-current="true">
      <span class="slide-dot-icon" aria-hidden="true"></span>
      <span class="slick-sr-only">Go to slide 1 of 6</span>
    </button>
  </li>
  <li>
    <button type="button" id="slick-slide-control01">
      <span class="slide-dot-icon" aria-hidden="true"></span>
      <span class="slick-sr-only">Go to slide 2 of 6</span>
    </button>
  </li>
  ...
</ul>
@jasonwebb jasonwebb added the feature change Change to an existing feature or functionality label Aug 16, 2020
jasonwebb added a commit that referenced this issue Aug 17, 2020
…ding aria-current, removing arrow key handler on dots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature change Change to an existing feature or functionality
Projects
None yet
Development

No branches or pull requests

1 participant