Web-facing change PSA: ctrl+mousewheel events can now be overridden

Showing 1-1 of 1 messages
Web-facing change PSA: ctrl+mousewheel events can now be overridden Rick Byers 3/14/14 11:36 AM
Prior to my fix for crbug.com/111059, ctrl+wheel events were handled directly by the browser to implement browser zooming.  I've changed this so the events are first sent to the renderer, and only invoke browser zoom when they go unhandled.  This is an immediate implication of the PSA I sent below, but probably wasn't obvious from my original message so I figured it was worth bringing up explicitly.

Motivation:
There are many websites that want to do something better for the user than trigger browser zoom.  For example, when a use does ctrl+wheel over a map in google maps, they almost certainly want to zoom in on the map, not invoke browser zoom to zoom the page.  Giving the page the event first is consistent with our "content not chrome" core principle, (and with allowing pages to override most keyboard events).

Risk:
Some websites (and Pepper plugins, etc.) are consuming all wheel events regardless of the modifiers and so will now change to cause browser zoom to be disabled (eg. perhaps triggering some application-specific scrolling when the user intended to zoom).  This appears to be the case, for example, in Google Sheets.

Behavior in other browsers:
This change matches IE and Firefox on Windows exactly, so sites should already be prepared for it.  On Linux and MacOS Firefox appears to disable mousewheel-based zooming whenever there is a wheel event handler (even if the handler doesn't call preventDefault on the event), and so is also consistent with what I've done.  Safari on Mac doesn't support zooming with a mouse wheel at all (just trackpad / mouse gestures which do not send events - see PSA below).

Thanks,
   Rick

On Wed, Jan 8, 2014 at 8:49 PM, Rick Byers <rby...@chromium.org> wrote:
tl;dr: in crbug.com/289887 I propose changing Chromium on Windows and Mac to match IE and Firefox behavior when the user performs a pinch on the trackpad.  In particular, dispatching a mousewheel event with the 'ctrl' modifier set, and allowing websites to prevent the default behavior.

Motivation:
On Windows and Mac, Chromium responds to trackpad pinch events to trigger browser zoom. In "naturally zoomable" applications such as Google maps this is a regular source of complaints - causing confusion for the user when they get browser zoom (text getting bigger, images pixelated, etc.) instead of zooming the map.

Behavior in other browsers:
IE also triggers browser zoom by default on trackpad pinch, but it sends a mousewheel event with the 'ctrl' modifier present.  If this event is consumed (through preventDefault()) then the browser zoom behavior is suppressed.  The Google maps folks I've talked with say this behavior works well for them.  Firefox also sends ctrl mousewheel events on trackpad pinch, but requires an add-on to be installed to trigger browser zoom with pinch.

Presumably the argument for this behavior here is that since trackpads emulate mouse-based scrolling through mousewheel events, they can also reasonably emulate the typical pattern for mouse-based zooming (holding control while rolling the mouse wheel).

This solution isn't perfect (a new dedicated API would be ideal), but I believe that since it matches the behavior of the two other major desktop browsers and requires no new web standards work, it's the best pragmatic trade-off.  Any objection?

Thanks,
   Rick