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

WordPress Trac noreply at wordpress.org
Thu Feb 15 16:56:26 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 deepakvijayan):

 Adjusting the event handling from **onkeyup** to **onkeydown** and passing
 the event object (event) as a parameter to the **browsePopup** function
 should help resolve the issues right?

 Using **onkeydown** would indeed prevent the page from scrolling down as
 well.


 For example inside **image-edit.php** if we change the following


 {{{
 <button type="button" class="imgedit-rleft button"
 onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate( 90, <?php
 echo "$post_id, '$nonce'"; ?>, this)"
 onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90° left'
 ); ?></button>
 }}}

 to


 {{{
 <button type="button" class="imgedit-rleft button"
 onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.rotate(
 90, <?php echo "$post_id, '$nonce'"; ?>, this)"
 onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90° left'
 ); ?></button>
 }}}

 similarly for all the buttons should help.

 Also **browsePopup** could receive the event attribute like below


 {{{
 browsePopup: function (event, el) {
 ...
 }}}


 Also, we won't have to worry about depending on the global
 {{{window.event}}}.

 I did test this out on my local environment and seems to be working fine.

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


More information about the wp-trac mailing list