WICG / auxclick

Description for non-primary button click event

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should preventDefault override middle click autoscroll?

lpd-au opened this issue · comments

The issues surrounding right click context menu are quite unintuitive and unfortunate, but in a similar vein, is MMB autoscroll intended to be a preventable behaviour of auxclick? Currently Firefox for Windows sends an auxclick event and opens the autoscroll menu, while Chrome for Windows doesn't fire an auxclick event and instead opens the autoscroll menu. Would this be worthy of a note in the spec?

This does sound reasonable to me. What do you think @bokand?

Is there any reason not to match Firefox? IMO, it makes sense for preventDefault to prevent autoscroll. Also note on Linux MMB generally shortcuts to paste. I would expect preventDefault to prevent that behavior too.

Just to clarify, in my testing Firefox Nightly behaved the same whether preventDefault was called or not, either way an auxclick event was fired but the autoscroll menu also appeared. (https://jsfiddle.net/nk7qgsm5/1/)

@bokand is there anywhere that we have specified the autoscroll? Or should we start specifying it here as the default behavior of auxclick when there is a scroller under the target (I'm not quite familiar with the autoscroll so ignore this "when" if it is not true)?

AFAIK autoscroll isn't specified - it'a s Windows platform feature. As such, I'm not sure we should specify it as anything other than "platform default action". i.e. we shouldn't treat it any differently than the Linux paste-on-middle-click behavior, or any other MMB platform behavior.

I was looking more into the behavior of autoscroll and realized that on Windows both on Chrome and FF the auto scroll icon shows up after mousedown not the click. So similar to the context menu this is not something that preventDefault on auxclick could control. @lpd-au WDYT?

Ah ok, silly me. So the correct thing to do is to preventDefault on pointerdown as well? Fortunately that seems to work even for chorded button presses (https://jsfiddle.net/yygp3qfa/2/). If Linux MMB paste also activates on pointerdown like contextmenu does then that would be handy for giving general platform-agnostic advice. Now I know to look for it, it does appear that the UI Events spec has a note on default actions of mousedown, even going so far as describing "a mouse-driven panning feature that is activated when the middle mouse button is pressed". All that considered, a second note for pointerdown beneath the one for contextmenu would be worthwhile in my opinion, but I'm no spec expert if you feel it's better left to the domain of MDN et al.

So maybe you want to mention it (or just create an issue) in the pointer event spec for the pointerdown one and I will follow up that issue in the pointer event working group.