Problem/Motivation

The first focused element on the modal once it's opened is typically the first link that appears inside the project description. However, not all project descriptions have a link. It's possible for a non-sighted user to miss the description, for example.

See https://www.drupal.org/project/project_browser/issues/3310908#comment-15... for more background.

Steps to reproduce

use project browser, find a project, click its title to open the modal "detail page"

Proposed resolution

MAYBE: add a focusable element (The title?) to the modal?

MAYBE: make the first focusable element the close button?

CommentFileSizeAuthor
#9 voiceover.mp42.08 MBrkoller
#9 dialog.mp4997.49 KBrkoller
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chrisfromredfin created an issue. See original summary.

utkarsh_33 made their first commit to this issue’s fork.

utkarsh_33’s picture

Status: Active » Needs review

I have implemented one of the two suggestions.

narendrar’s picture

Status: Needs review » Needs work

Asserting focus in exiting modal test can be helpful here.

rkoller’s picture

adding a tabindex to non-interactive is not adviced (see for example https://www.a11yproject.com/posts/how-to-use-the-tabindex-attribute/). https://html.spec.whatwg.org/dev/interactive-elements.html#the-dialog-el... suggests

As such, authors should use the autofocus attribute on the descendant element of the dialog that the user is expected to immediately interact with after the dialog opens. If there is no such element, then authors should use the autofocus attribute on the dialog element itself.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog suggests:

The autofocus attribute should be added to the element the user is expected to interact with immediately upon opening a modal dialog. If no other element involves more immediate interaction, it is recommended to add autofocus to the close button inside the dialog, or the dialog itself if the user is expected to click/activate it to dismiss.

i would rather lean toward the smallest commone denominator between the two aka focus on the dialog element itself instead of focusing on the close button cuz the intend of the dialog modal is that some browsing of the content and interaction with the elements in the modal happens. but i guess it would make sense to also start thinking and opening a follow up issue about the general structure of the dialog modal content (implementing the things we'Ve learned from the survey and which got aggregated into the quality indicators.png)

utkarsh_33’s picture

Status: Needs work » Needs review

Not sure whether there is a better way of doing this but now the focus is on the modal element.Marking it NR.

narendrar’s picture

Status: Needs review » Reviewed & tested by the community

Tested manually and focus is now set on modal. Moving it to RTBC.

rkoller’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +wcag247
StatusFileSize
new997.49 KB
new2.08 MB

thanks for the changes... the dialog modal getting the initial focus looks good... but i've noticed several more problems in the context of the a11y within the dialog modal. so far i have only tested it with modules that havent had an image carousel, plus i havent taken a closer look with voiceover active neither (see and hear dialog.mp4 and voiceover.mp4).

  • with the dialog modal being the first element in focus it feels sort of odd to have the close button as the second in the tabindex? would it be possible and be better if the close button would become the last in the tabindex in the dialog modal?
  • the back and forth buttons of the image carousel in the dialog modal are missing a visible focus outline (SC2.4.7).
  • The labels for the next button with "slide right" is not clear (why not use something like "next image" and "previous image") in particular due to the fact that all the images in the carousel are labeled as decorational. with only two images you only have a single button cuz the other is disabled. with more than two images you then have a slide left and slide right buttons but no content you the user are sliding inbetween.
  • the disabled button is not reflected in the aural interface and that way things might become confusing for screenreader users. using aria-disabled="true" instead of disabled would make the disabled button tabable and labeled as dimmed/disabled in for example voicover
  • the tab order is odd. as demonstrated in voiceover.mp4, if the focus is on the slide right button, you press return and the button turns disabled and you press shift-tab to get back to the slide left button you get to the learn more button instead?!
  • in dialog.mp4 and voiceover.mp4 i manage each time to get with the focus outside the dialog modal into the background of the modal which should not happen.

i set the issue back to needs work. the other option might be to move some of those points to follow up issues to keep the scope for this issue, but due to the fact that this issue is about the a11y of the dialog modal i set it back to needs work for now

chrisfromredfin’s picture

Status: Needs work » Reviewed & tested by the community

Actually, each of these bullets should be its own sub-issue. If you want to collect all modal-related a11y issues, you can do a meta and do each bullet as a child; but, we need to keep scope as SMALL as possible for issues. Moving this one back to RTBC.

chrisfromredfin’s picture

Title: Accessibility of detail modal » Accessibility of detail modal: focus the modal window on open

chrisfromredfin’s picture

Status: Reviewed & tested by the community » Fixed

There will be more a11y fixes coming, but I aim to try to keep them as small and narrowly scoped as possible.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.