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

WordPress Trac noreply at wordpress.org
Sun Mar 29 20:52:21 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):

 Replying to [comment:31 slkfsdf8y34ljhsfsdfkuhfkl84hj]:
 > "In order to use passive listeners the handlers need to be written in a
 way that does not rely on event.preventDefault(). "
 >
 > Otherwise it won't be compatible with the minority of IE11 users,
 otherwise it would be working as expected?
 >
 > I did some tests with the lighthouse scores in terms of ranking and I
 found that on many occasions it helped rankings overall.
 >
 > The current situation is decreasing the scores a lot.

 This is unrelated to IE11 support, per the [https://developer.mozilla.org
 /en-US/docs/Web/API/EventTarget/addEventListener MDN addEventListener
 documentation] using a passive listener will cause the event to fail and
 throw a console error if it contains `event.preventDefault()`:

 > A Boolean which, if true, indicates that the function specified by
 listener will never call preventDefault(). If a passive listener does call
 preventDefault(), the user agent will do nothing other than generate a
 console warning.

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


More information about the wp-trac mailing list