Automattic / _s

Hi. I'm a starter theme called _s, or underscores, if you like. I'm a theme meant for hacking so don't use me as a Parent Theme. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for.
http://underscores.me/
GNU General Public License v2.0
10.94k stars 3.12k forks source link

Use passive listener to improve scroll performance #1361

Closed dswebsme closed 5 years ago

dswebsme commented 5 years ago

Currently navigation.js (line: 102) defines a touchstart event listener with an options parameter of false. Modern best practices recommend using passive listeners to improve scrolling performance on mobile devices.

As an example: parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); would become: parentLink[i].addEventListener( 'touchstart', touchStartFn, { passive: true } );

dswebsme commented 5 years ago

Cancel this. Setting passive to true prevents expand / collapse of menu items on touch devices. The potential performance gains in Chrome do not justify rewriting working code.