[wp-trac] [WordPress Trac] #60548: Image editor: improve the browsePopup function

WordPress Trac noreply at wordpress.org
Thu Feb 15 14:20:11 UTC 2024


#60548: Image editor: improve the browsePopup function
-----------------------------+----------------------------------------
 Reporter:  afercia          |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Media            |     Version:  6.3
 Severity:  normal           |  Resolution:
 Keywords:  has-screenshots  |     Focuses:  accessibility, javascript
-----------------------------+----------------------------------------

Comment (by afercia):

 Some more details:
 - The `event` used [https://github.com/WordPress/wordpress-
 develop/blame/7b24083859c37d8ac75b9549f458bc389610eaef/src/js/_enqueues/lib
 /image-edit.js#L302 here], [https://github.com/WordPress/wordpress-
 develop/blame/7b24083859c37d8ac75b9549f458bc389610eaef/src/js/_enqueues/lib
 /image-edit.js#L304 here], and [https://github.com/WordPress/wordpress-
 develop/blame/7b24083859c37d8ac75b9549f458bc389610eaef/src/js/_enqueues/lib
 /image-edit.js#L309 here] is the gloabl `window.event`, which is
 deprecated.
 - The `preventDefault()` used [https://github.com/WordPress/wordpress-
 develop/blame/7b24083859c37d8ac75b9549f458bc389610eaef/src/js/_enqueues/lib
 /image-edit.js#L309 here] doesn't actually prevents the page scrolling
 default action because the event in use is `keyup` which fires when a key
 is released. At that point the page scroll already occurred when pressing
 the key.
 - As a minor improvement, I;d suggest to rename the `$target` variable as
 that's not a jQuery object wrapping a DOM object. It is either `false` or
 the value returned by jQuery `get()` which is the DOM object.
 Traditionally, the core JavaScript prefixes variable names with `$` as a
 convention for jQuery objects while this is a 'native' DOM object.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60548#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list