[wp-trac] [WordPress Trac] #36848: Theme installer: avoid to announce the search results too many times
WordPress Trac
noreply at wordpress.org
Mon May 16 14:23:20 UTC 2016
#36848: Theme installer: avoid to announce the search results too many times
-------------------------------------------+-----------------------------
Reporter: afercia | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.6
Component: Themes | Version:
Severity: normal | Keywords: has-screenshots
Focuses: ui, accessibility, javascript |
-------------------------------------------+-----------------------------
Noticed two cases where the search results message is unnecessarily
dispatched to the aria-live region.
'''1 Initial render of the view'''
When the view is initially rendered, looks like `announceSearchResults()`
runs both on render and on the `query:success` event.
'''2 When using the arrow keys on the search input field'''
When doing a search in the Themes Installer and after the results are
displayed users might want to select or edit the search terms in the input
field to refine their search. To do this they will probably use the arrow
keys (or the Home/End keys, etc.).
As soon as an arrow key is pressed, the search results message will be
dispatched again to the aria-live region.
Investigated a bit and looks like this happens because there's nothing to
check which keys get pressed or to check if the search terms have changed.
At the very least, I'd say there should be a check on the search terms,
also for consistency with what happens in the Installed Themes screen.
TL;DR
While in the Installed Themes screen `themes.view.Search.doSearch` uses
`themes.Collection.doSearch` which checks the current search input field
value against the previous search and returns early if they're equal...
in the Themes Installer instead, `themes.view.InstallerSearch` does extend
`themes.view.Search` but then implements its own `search` and `doSearch`
functions which miss to check the search input field value against the
previous search.
Thus, while previous search results are actually cached and a new API call
is prevented, a `query:success` custom event is triggered anyways and on
this event other things run again including:
- the count text update
- more importantly, `announceSearchResults()` runs again
Tried to catch this in the screenshot below, to make it easier to
reproduce. Just run a search and then move the cursor in the input field
using the arrow keys:
[[Image(https://cldup.com/bWLPriMY_c.png)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36848>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list