Improve accessibility for the list and grid button

Created on 11 May 2024, 7 months ago
Updated 3 July 2024, 5 months ago

Problem/Motivation

At the moment the button state , if pressed or not, of the list and grid buttons is not available in the aural interface. A screenreader user has no way to distinguish which of the two buttons is actually pressed, see missing_toggle_state.mp4.

Steps to reproduce
  • Go to /admin/modules/browse
  • Activate your screenreader of choice
  • Tab to the list and grid buttons
  • Also hover and press the buttons

Proposed resolution

  • In regards of the toggle state the aria-pressed attribute could be used and a pattern similar to what leonie watson is using on https://tink.uk - she is also a pattern with two button elements
  • In regards of the missing styles follow the drupal design system in this follow up issue: πŸ“Œ Improve styling for the list and grid button Active
πŸ› Bug report
Status

Fixed

Version

2.0

Component

User experience

Created by

πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rkoller
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States kwiseman

    I added the suggested aria-pressed attribute to the Link and Grid buttons that functions similarly to the two button grouping on https://tink.uk.

    However, I wasn't sure how to go about applying the hover and active state styling on them given that the background color of the selected display button (either Link or Grid) in any state is the same as the design system's button active state background color. (In other words, the background of a selected Link or Grid display button is always #ADAEB3). When hovering over a selected display button, should it get 15% darker than #ADAEB3, and 30% darker if the user clicks it again? I looked around in the design system and other admin pages to try to find an example to copy, but couldn't.

    I was thinking a solution to this hover/active state styling problem could be changing the color of the selected display button to blue, and then apply the design system's hover and active state styling as usual. Project Browser's Figma Designs shows an example of this on the "Updated MVP April 2022" page, on the frames that start with "April 2022: New Design Draft", but since they're called drafts, I wasn't sure.

  • Status changed to Needs review 6 months ago
  • πŸ‡¦πŸ‡ΊAustralia sime Melbourne

    I think #3 makes sense, and i think this should be needs review.

  • πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

    hm i am not sure if changing the styling from the regular button grey to the primary button blue for the pressed button would be the right choice. might be potentially confusing :/ technically there doesn't exist an actual toggle state for the drupal design system unfortunately yet. :( the following comment and the comments in the following in this thread https://drupal.slack.com/archives/C1AFW2ZPD/p1704456082112179?thread_ts=... are about introducing a toggle state to claro. the switch between the grid and list view would actually another example to be named in the list of examples in this linked discussion.

    I wonder if it would make sense to narrow the scope for this issue and make it only about screenreader accessibility and move the design to a dedicated issue and maybe ping @ckrina in that regard, bringing the new toggle state for the drupal design system back on the map? what do you all think?

    and would it be possible that you open a MR for this issue fork. that way it would be easier to apply the patch for me since i rely only on the composer patches based workflow still. would have to manually test the changes in voiceover.

  • πŸ‡ΊπŸ‡ΈUnited States kwiseman

    kwiseman β†’ changed the visibility of the branch 3446591-improve-styling-and to hidden.

  • Pipeline finished with Success
    6 months ago
    Total: 353s
    #186271
  • πŸ‡ΊπŸ‡ΈUnited States kwiseman

    Personally, I think it makes sense to narrow the scope of this issue to just the screenreader accessibility and move the design part to its own issue, given that design for the toggle state doesn't exist yet.

    I created a merge request on a new branch that's caught up with 1.0.x and has the same changes.

    Also, I forgot to mention in #3 that I manually tested with VoiceOver on a Mac in Firefox. Manual testing with other screen readers and/or browsers is probably necessary.

  • Pipeline finished with Success
    6 months ago
    Total: 419s
    #189424
  • πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

    thankt @kwiseman, this looks good! i've also tested in safari and edge with voiceover. the only small nitpick with voiceover is that if you have a state change from not pressed to pressed, voiceover is just announcing "selected" without repeating the context like for example "selected list toggle button". but that is a voiceocer thing.

    one detail i've noticed, i am testing on drupal 11.x-dev, project browser is still using yarn 1.x, but drupal 11 is requiring yarn 4 for a few weeks now: https://www.drupal.org/node/3428571 β†’ . would it make sense to create a follow up upgrading the yarn version?

    and in regards of the styling, we've both agreed (according to your comment on the thread on slack) to move the styling to new issue. the only question is how to approach it. cuz that would be an issue for core in general, project browser would be the exception having two toggle buttons next to each other which are slightly different contstraints. not sure but probably a single issue summarizing the points from the linked thread including the requirement for project browser as another mandatory variant might be the best choice?

  • πŸ‡ΊπŸ‡ΈUnited States kwiseman
  • πŸ‡ΊπŸ‡ΈUnited States kwiseman
  • πŸ‡ΊπŸ‡ΈUnited States kwiseman

    kwiseman β†’ changed the visibility of the branch 3446591-improve-styling-and to active.

  • πŸ‡ΊπŸ‡ΈUnited States kwiseman

    kwiseman β†’ changed the visibility of the branch 1.0.x to hidden.

  • Pipeline finished with Success
    5 months ago
    Total: 476s
    #203055
  • Status changed to RTBC 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States bernardm28 Tennessee

    Seems like this issue MR accomplishes the main goal of this issue.
    It could always be improved later on a follow-up.

  • πŸ‡ΊπŸ‡ΈUnited States kwiseman
  • Pipeline finished with Success
    5 months ago
    Total: 565s
    #203101
  • πŸ‡ΊπŸ‡ΈUnited States kwiseman

    kwiseman β†’ changed the visibility of the branch 2.0.x to hidden.

  • Merge request !523Fixes #3446591 for 2.0.x branch. β†’ (Merged) created by kwiseman
  • Pipeline finished with Success
    5 months ago
    Total: 2621s
    #203108
  • Pipeline finished with Success
    5 months ago
    Total: 552s
    #203126
  • First commit to issue fork.
  • Pipeline finished with Skipped
    5 months ago
    #203221
  • Status changed to Fixed 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States chrisfromredfin Portland, Maine

    Easy win for a11y!

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

Production build 0.71.5 2024