[wp-trac] [WordPress Trac] #37233: Shiny Updates: "Add New Plugin" shiny search issues
WordPress Trac
noreply at wordpress.org
Sun Jul 17 22:08:47 UTC 2016
#37233: Shiny Updates: "Add New Plugin" shiny search issues
-------------------------------------+-------------------------------------
Reporter: afercia | Owner: swissspidy
Type: defect (bug) | Status: assigned
Priority: high | Milestone: 4.6
Component: Plugins | Version: trunk
Severity: major | Resolution:
Keywords: has-screenshots shiny- | Focuses: ui, accessibility,
updates has-patch | javascript
-------------------------------------+-------------------------------------
Comment (by azaozz):
Replying to [comment:20 adamsilverstein]:
> * switch the event from `search` to the standard `input` as suggested by
@afercia and as used for the installed plugin search (and elsewhere in
core JS). I am not certain we need keyup at all, I think it is required
for certain browsers that don't trigger 'input' - @azaozz would probably
know for sure :)
Good idea. For text fields the `input` event is not supported only in IE8:
http://caniuse.com/#feat=input-event. It is fired on every keystroke that
changes the element's value. It's advantage over the `key*` events is that
it is not fired on "non-printing" keys like arrow keys, Esc, page up/down,
etc. and is fired on paste and on other input methods like entries from
speech recognition. That makes it perfect for triggering anything that
requires some user input first.
Looking at 37233.3.diff: to support IE8 (ugh!) and to catch the Esc key
the patch will still need to use `keyup` but separate from `input`, then
do something like `if ( ! 'oninput' in document ) ...`. The searching
function will have to be separate so it can be called from both events.
> * when changing the dropdown, we should trigger the search again even if
the search field string hasn't changed, I updated the logic to ensure that
works
>
> I noticed that we are triggering a search when the field is blank, for
example changing the dropdown or hitting the escape button. This shows all
plugins and seems unexpected. Do you think we should avoid searching when
the search field is blank?
Using only the `input` event will stop triggering the search on "non-
printing" keys. However it is best to trigger the AJAX only after the user
enters at least 2 characters.
Thinking that ideally it should trigger after 2 ASCII chars or one high
UTF-8 char. We can standardize this for all similar cases in core, there
are at least 6-7 other places.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37233#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list