Problem/Motivation
Drupal.announce() is used on the module listing page, to announce the number of results whenever the module-filter search box is used to narrow the range of modules shown.
However these announcements are not made if the Toolbar module is disabled.
The call to Drupal.announce() is in system.modules.js, but the library info doesn't declare drupal.announce as a dependency.
This doesn't cause a problem if the standard install profile was used, as the toolbar module pulls in the drupal.announce library as a dependency. The core toolbar module isn't a required module though, and contrib modules could provide an alternative toolbar some day. The minimal install profile in core does not install Toolbar module.
Steps to reproduce
Compare the admin/modules page between a standard and minimal install.
- Standard profile behaves as expected, announcing a result-count when the module filter is used.
- Install Drupal with the standard profile. This will enable Toolbar module.
- Visit admin/modules with a screenreader running.
- Use the module filter to search for "cache". The module list will be updated to show just 2 modules, and the screenreader will announce that "2 modules are available in the modified list".
- Browser dev tools confirm that Drupal.announce exsts as a function.
- Minimal profile does not provide screenreader feedback when module filter is used.
- Install Drupal with the minimal profile. Toolbar module will not be enabled.
- Visit admin/modules with a screenreader running.
- Use the module filter to search for "cache". The module list will be updated to show just 2 modules, but the expected screenreader announcement does not happen.
- Browser JS console reports an error: "Drupal.announce is not a function".
Proposed resolution
Declare core/drupal.announce as a dependency of system/drupal.system.modules
Remaining tasks
Make a patch - DONE.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | module_filter_does_not_announce_result_count-2702969-2.patch | 390 bytes | andrewmacpherson |
Comments
Comment #2
andrewmacpherson commentedComment #3
andrewmacpherson commentedThis does the trick. I tested the patch with simplytest.me and ChromeVox.
After a minimal install,
announce.jsis loaded on the modules listing page, and the result count is announced when using the module filter.Comment #4
andrewmacpherson commentedComment #5
andrewmacpherson commentedComment #6
andrewmacpherson commentedComment #8
BarisW commentedI've tested the patch on simplytest and I can confirm that it works with a Minimal profile install.
Comment #9
andrewmacpherson commented@BarisW thanks!
Comment #10
andrewmacpherson commentedWe can actually write a FunctionalJavascript test to confirm that the Drupal.announce() div gets updated correctly when using the module filter.
Over at #2715663: Use Drupal.formatPlural for when announcing module-filter results for screenreader users the patch includes a FunctionalJavascript test which tests the module filter's basic functionality, and the Drupal.announce messages.
it's a bit of a chicken/egg scenario with these two issues, so I've just added a dependency on Toolbar module to the test in the other issue, until this one is fixed. That issue actually has more interesting stuff that needs testing, while this is just a simple library declaration.
Comment #11
andrewmacpherson commentedComment #12
alexpottCommitted and pushed 55469c5 to 8.3.x and 7a80041 to 8.2.x. Thanks!
Okay lets get the test added in #2715663: Use Drupal.formatPlural for when announcing module-filter results for screenreader users
Comment #16
andrewmacpherson commentedThis relates to the new WCAG 2.1 success criterion : 3.2.7 Change of Content.