[wp-trac] [WordPress Trac] #47510: Developer tool - Best Practice - input comment field Does not use passive listeners

WordPress Trac noreply at wordpress.org
Sun Feb 23 04:46:04 UTC 2020


#47510: Developer tool - Best Practice - input comment field Does not use passive
listeners
------------------------------------+--------------------------------------
 Reporter:  efilippucci             |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Comments                |     Version:  5.2.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch needs-        |     Focuses:  javascript, performance
  refresh                           |
------------------------------------+--------------------------------------

Comment (by peterwilsoncc):

 Both the reply and cancel button event handlers use
 `event.preventDefault();` so switching to passive handlers can't be made
 without other refactoring.

 I can't see how the event handlers can be rewritten to avoid
 `event.preventDefault();` for a couple of reasons:

 * without preventing the default action, clicking the links will cause
 them to be followed by the browser
 * backward compatibility with custom comment engine plugins overwriting
 the `moveForm()` function

 While a high lighthouse score feels nice, it's an automated score-card.
 Changes such as this would need to come with substantiated performance
 increases.

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


More information about the wp-trac mailing list