Problem/Motivation

The uninstall page (admin/modules/uninstall) has a text filter to make it easy to find a module you are interested in.

When filtering the list, Drupal.announce() is used to inform screen reader users how many rows are now shown on the page. However, this announcement is always "0 modules are available in the modified list" no matter whether there are matches or not.

The same Drupal.behaviors.tableFilterByText is used for both the install and uninstall pages, but the page structure is different. It looks like the filter logic only works properly on the install page.

Proposed resolution

Fix the Drupal.announce() message so the module count is correct.

Investigate the jQuery CSS selectors used by system.modules.es6.js to see why the counts passed to Drupal.announce() are wrong.

Remaining tasks

User interface changes

Fixes a bug in a custom screen reader announcement.

API changes

None.

Data model changes

None.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

Issue summary: View changes
andrewmacpherson’s picture

andrewmacpherson’s picture

Issue summary: View changes
andrewmacpherson’s picture

This bug falls under the new 3.2.7 Change of Content success criterion from the forthcoming WCAG 2.1

waako’s picture

The problem in system.modules.es6.js is that line 65 $rowsAndDetails.find('tbody tr:visible').length searches for visible rows inside a table.
But $rowsAndDetails as defined Line 88 $rowsAndDetails = $table.find('tr, details'); consists of all table rows and detail elements.

On the Module list/install page each module list table has a category detail wrapper, so that works fine, but on uninstall page, it's just one table, so never finds tbody tr inside tr.

WIthout modifying the markup, I was able to get it working everywhere by using filter instead of find and targeting the visible table rows with [data-drupal-selector] attribute:
Line 88 to { '!modules': $rowsAndDetails.filter('tr[data-drupal-selector]:visible').length }

May be worth categorising modules on uninstall page, to match the markup.

MaskOta’s picture

Version: 8.4.x-dev » 8.5.x-dev
Status: Active » Needs review
FileSize
1.57 KB

Thanks waako for the analysis. Here is the patch based on that.

waako’s picture

Applied patch in #7 It works perfectly.

Added test core/modules/system/tests/src/FunctionalJavascript/ModuleFilterTest.php (inspired from https://www.drupal.org/project/drupal/issues/2715663#comment-11682359).

Only 2 modules are available on uninstall page for testing profile, but still manage to test the following:

  • The filter reduces the number of visible modules
  • The Drupal.announce() message div contains a correct plural message when multiple modules are visible
  • The Drupal.announce() message div contains a correct plural message when one module is visible
  • The Drupal.announce() message div contains a correct plural message when zero modules are visible

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.