Problem/Motivation

Our draggable tables (tabledrag.js) hasn't changed much since it was introduced in D7. Let's look at ways to make tabledrag's accessibility better.

Currently tabledrag doesn't really work for screen readers, and we kept the fallback method with row weights. It's worth looking at ways to modernize this, so screen reader users can have a more equivalent experience.

Proposed resolution

A number of more modern approaches to accessible drag and drop are in #2920006: Research accessibility of drag-and-drop grid interfaces.. Some improvements we could make include:

  • Make it understandable for screen reader users. Currently the drag-handles are keyboard-operable but the outcome of moving it isn't yet perceivable or understandable. If the outcome of using the drag-handles can be conveyed to screen reader users, they will have a more equivalent experience to sighted users.
  • Use different icons to visually convey what kind of movements are allowed. A vertical 2-arrow icon for a simple up/down order, versus a 4-arrow icon for situations where rows can be ordered as nested trees. A vertical 2-arrow icon is available in the Libricons icon set used by Classy/Bartik/Seven.
  • #2912737: Table Drag showing visual feedback when move was forbidden
  • Make the show row weights alternative method work better for situations where there are more than 31 rows. See Problems with weight range in book module. Quick-win idea: use a HTML5 number input instead of the limited range dropdown. (Note, we already have this in MediaLibraryWidget.)
  • #3035435: Make the show/hide row weights button more informative for assistive tech users.

Remaining tasks

Use child issues for implementation.

  • Add a styling hook for the 2-arrow vs 4-arrow icons. NEEDS CHILD ISSUE.
  • Include the 2-arrow (up/down) vs. 4-arrow (nested) distinction in the Claro theme. #3032365: Table drag style update.
  • Convert the "-15 to 15" row weights to a HTML5 number field. NEEDS CHILD ISSUE.

User interface changes

Yes, modest design changes may be involved to help convey some aspects of tabledrag behaviour visually.
Non-visual improvements for assistive tech are also proposed, which may involve new translatable strings.

Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

An idea for a quick-win improvement for the visual style of the drag handles....

Tabledrag can be configured to for nested and un-nested lists.

For un-nested lists, items can only be moved up and down. Left and right movements are not allowed. Yet the icon on the drag handle shows 4 arrows, and implies that 2-dimensional movement is allowed.

How about using a different icon for the un-nested tabledrag, showing just the up/down directions?

andrewmacpherson’s picture

The tabledrag icon comes from Lubricons, originally added in #2032773: Use Libricons (icon font) in Seven, consider using it more broadly in core.

It looks like Libricons has an up-down icon, we just don't have it Drupal core.

andrewmacpherson’s picture

Related: the row weights fallback can be hard to use too. We've had a report that if there are more than 31 rows, you can't achieve full control over the order. It seems reasonable that book module would exceed this limit. See Problems with weight range in book module, posted in the Drupal Accessibility Group.

This should probably have a separate issue, bevause we also have weight fields outside the context of tabledrag.

andrewmacpherson’s picture

Issue summary: View changes
Issue tags: -Accessibility +accessibility
Related issues: +#3032365: Table drag style update

Organized issue summary so it's a bit more like a plan now.

Showing a different icon for up/down only constraint would need some kind of styling hook; e.g. a class or data-* attribute to distinguish the nested-tree and up/down tabledrag variants. I looked at the markup using browser dev-tools, and there isn't anything like that currently.

andrewmacpherson’s picture

andrewmacpherson’s picture

Issue summary: View changes

In the accessibility group discussions, there was a request for help with book module. It turns out that the "show row weights" alternative method doesn't scale to situations where there are more than 31 rows to re-order. See
Problems with weight range in book module
. This should get a child issue: a quick win might be to replace the 31 option drop-down select with a HTML5 number field, to permit click-nudging or directly typing a number.

The row weights UI is a very old part of Drupal, which pre-dates the JS dragable behaviour. Even if we can report the outcome of keyboard arrow operations to screen reader users, the row-weights method is still worth keeping around. Speech control users can access it.

andrewmacpherson’s picture

Issue summary: View changes
andrewmacpherson’s picture

Adding an issue that came out of the Media Library accessibility plan. Look at how to improve the show/hide row weights button, and inform the user of the outcome.

tim.plunkett’s picture

Issue tags: -accessibility (duplicate tag) +Accessibility

Fixing tag

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mgifford’s picture

Issue tags: -JavaScript +JavaScript, +wcag251