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
- Fix
system.modules.es6.js
filter logic so it uses the correct count. - Use
Drupal.formatPlural()
for the message text. NOTE: the announcement on the install page doesn't correctly pluralize, so this issue overlaps with #2715663: Use Drupal.formatPlural for when announcing module-filter results for screenreader users. - Update the transpiled
system.module.js
- FunctionJavascript tests. Test the expected message for 0, 1, and multiple matches. Use the test logic from #2805205: Provide screen-reader feedback when filtering by block name. as a starting point.
User interface changes
Fixes a bug in a custom screen reader announcement.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#36 | 2923136-36.patch | 4.31 KB | _utsavsharma |
#36 | interdiff_10-0-x.txt | 573 bytes | _utsavsharma |
#35 | 2923136.35.patch | 5.09 KB | _utsavsharma |
#35 | interdiff_9-5-x.txt | 1.34 KB | _utsavsharma |
#30 | 2923136-30.patch | 4.32 KB | _utsavsharma |
|
Comments
Comment #2
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #3
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #4
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #5
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThis bug falls under the new 3.2.7 Change of Content success criterion from the forthcoming WCAG 2.1
Comment #6
waako CreditAttribution: waako as a volunteer commentedThe 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 categorydetail
wrapper, so that works fine, but on uninstall page, it's just one table, so never findstbody tr
insidetr
.WIthout modifying the markup, I was able to get it working everywhere by using
filter
instead offind
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.
Comment #7
MaskOta CreditAttribution: MaskOta commentedThanks waako for the analysis. Here is the patch based on that.
Comment #8
waako CreditAttribution: waako at Annertech commentedApplied 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:
Comment #10
borisson_This needs an actual comment, not an empty docblock.
Comment #14
waako CreditAttribution: waako at Annertech commentedFixed missing comment in function docblock from #10.
Replaced deprecated
JavascriptTestBase
withWebDriverTestBase
.Sorry couldn't get an interdiff, original patch wouldn't apply to 8.9.x so had to recreate the changes manually.
Comment #16
waako CreditAttribution: waako at Annertech commentedI had issues running the tests locally, but finally got it working so was able to better identify issue.
With testing profile, number of preinstalled modules has changed, so removing assertEquals that original module count matches filtered list with string cache as we can't know how many modules will be in the list and if all have a common string.
Comment #17
bnjmnmThere are some JS coding standards not being met here, but they can be fixed automatically with yarn prettier.
.module name is the only part of the locator that is necessary here.
It's quite possible that using
self::
has no adverse effects, but these uses should be changed to$this
to be consistent with other FunctionalJavascript testsThere are several coding standards not being met here. The @return and @param need to be separated by a space, the should be descriptions for both, the $elements arg needs a type hint and there should be a space after
function
. Few have been able to remember all these rules and remain sane. Let code sniffer take care of this for you.I suspect this could be quite confusing, but not sure if it's in the scope of this specific issue. If it's determined it's not in scope, a followup should get created before this is RTBC.
Comment #18
DamienMcKennaThis includes fixes for items 2 and 3 from comment #17.
Comment #19
waako CreditAttribution: waako at Annertech commentedThanks for the code review feedback bnjmnm, and DamienMcKenna for fixing 2. and 3.
Here's items 1. and 4. updated, likely similar issues with my work at https://www.drupal.org/project/drupal/issues/2715663
I've used the test logic from BlockFilterTest.php for updating the @para and @return as that's what it was inspired from in first place.
With regards to the the filtered results including modules that cannot be uninstalled, I think a follow up issue for discussion is appropriate:
A screen reader can usually list all visible form controls on the page, this will include the disabled checkboxes but on focusing it will announce that it is dimmed/disabled then can read remaining text in table row which explains why module can't be uninstalled.
I can't say if that is good enough, so best discussed in a separate issue.
Comment #24
ranjith_kumar_k_u CreditAttribution: ranjith_kumar_k_u at Zyxware Technologies commentedRe-rolled #19 for 9.4
Comment #26
yogeshmpawarUpdated patch will fix test failures.
Comment #29
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.
At this time we will need a D10 version of this patch.
Comment #30
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs for DrupalFit commentedRerolled for 10.1.x.
Comment #31
smustgrave CreditAttribution: smustgrave at Mobomo commentedRemoving the Reroll tag.
Testing patch #30 by going uninstall page and doing random filters checking that the announce was updating correctly.
I didn't see a tests-only patch so ran locally without the fix
Passes with fix.
Comment #32
mgiffordComment #34
lauriiiOpened a follow-up for #17.5.
Committed 89eb557 and pushed to 10.1.x. Thanks!
As a non-disruptive change, this would be qualified for a backport. However, the patch doesn't apply to 10.0.x or 9.5.x so that will require additional patches.
Comment #35
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs for DrupalFit commentedPatch for 9.5.x.
Comment #36
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs for DrupalFit commentedPatch for 10.0.x.