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

Document outline: Should be links not buttons #7142

Closed
anevins12 opened this issue Jun 5, 2018 · 2 comments
Closed

Document outline: Should be links not buttons #7142

anevins12 opened this issue Jun 5, 2018 · 2 comments
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Milestone

Comments

@anevins12
Copy link
Contributor

anevins12 commented Jun 5, 2018

Describe the bug
Anchor tags are not being used to structure the Document Outline functionality. Anchor tags are meant to lead to information on the same page or on another page and are the most suitable element to be used in this section.

We are emulating the hyperlink behaviour by moving keyboard (and viewport) focus to the relevant area, but the behaviour may be unpredictable to blind users (even with the help text).

To Reproduce
Steps to reproduce the behavior:

  1. Edit a page with multiple headings as blocks
  2. Click on the 'table-of-contents' icon
  3. Look at the markup of buttons underneath the title "Document Outline"
  4. See they are structured as <button> elements.

example

Current Markup
<button class="document-outline__button"> <span class="document-outline__emdash" aria-hidden="true"></span> <strong class="document-outline__level">Title</strong> <span class="document-outline__item-content">Gutenberg, imagine the possibilities</span> <span class="screen-reader-text">(Click to focus this heading)</span> </button>

Expected behavior
As a blind user of a screen reader, I would expect that hyperlinks lead to somewhere (and the focus will be moved there), and I would expect the behaviour of buttons to be less predictable in general.

Expected Markup
<a class="document-outline__button" href="..."> <span class="document-outline__emdash" aria-hidden="true"></span> <strong class="document-outline__level">Title</strong> <span class="document-outline__item-content">Gutenberg, imagine the possibilities</span> <span class="screen-reader-text">(Click to focus this heading)</span> </a>

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser: Chrome
  • Version: Latest
    However this issue is not specific to a browser.

Additional context

  • If the markup is changed to a hyperlink then we may need to reconsider text in the hyperlink for it to make more sense as a hyperlink.
@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels Jun 6, 2018
@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone Jun 6, 2018
@mtias mtias added the [Status] In Progress Tracking issues with work in progress label Nov 14, 2018
@tofumatt
Copy link
Member

I'm moving this out of WP 5.0 to 5.0.x for now but if #10815 is finished we can get it into Gutenberg 4.5 and in WordPress 5.0.

@afercia
Copy link
Contributor

afercia commented Feb 26, 2019

Worth reminding #11711 aims to do the same for the Block Navigation. This change to links should happen at the same time for both components.

Also, when switching the Editor to text (code) mode, the links should be rendered just as text. For now, the document outline buttons switch to a state with "noop and aria-disabled", see #14081.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants