Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse back/forward buttons: page navigation or JS events? #191

Closed
mustaqahmed opened this issue Mar 28, 2017 · 11 comments
Closed

Mouse back/forward buttons: page navigation or JS events? #191

mustaqahmed opened this issue Mar 28, 2017 · 11 comments
Labels

Comments

@mustaqahmed
Copy link
Member

In all browsers I tested (Edge, FF on Linux, Chrome on Linux/Android), the back/forward button-downs in a 5-button mouse performs backward/forward page navigation. This is true even in full-screen mode for FF & Chrome (Edge doesn't seem to have the mode).

So the X1(back) and X2(forward) button/buttons values in the spec seem useless in all current implementations!

If we want to standardize a reasonable behavior here, I see the following possibilities from "most breaking" to "least":

  • A. Expose all pointerdown events w/o any page navigation. This seems to be too breaking in terms of user experience given the consistency in current browsers.
  • B. Make page navigation the default action for pointerdown with button=back/forward, so canceling the event would suppress page navigations. This also seems bad because page navigation depends on where you click.
  • C. Allow page navigation outside full-screen mode only. If the only scenario where back/forward button/buttons values could be useful is full-screen gaming, then the spec should say so, and leave the current non-full-screen behavior unchanged.
  • D. Make page navigation cancelable only in full-screen mode. This is like B+C.
  • E. Drop back/forward button values from PointerEvent spec.

Thoughts?

@lpd-au
Copy link

lpd-au commented Apr 8, 2017

B is already the current behaviour for middle click and autoscroll, so that would seem consistent to me.

@smaug----
Copy link
Contributor

doesn't the OS send back/forward command to the browser in this case, so there isn't really much pointer events related happening? (I should re-check the implementation.)

@mustaqahmed
Copy link
Member Author

Chrome gets regular mouse events from OS but back/forward button presses are not forwarded to the content layer.

@dtapuska
Copy link

@smaug---- I believe on Windows you get a XBUTTON event if you don't indicate it is handled then it will send you an APPCOMMAND. Chrome doesn't follow this mode for context menus and I'm proposing Chrome doesn't follow it for these buttons either. This would be similar to how it works on X11.

See https://msdn.microsoft.com/en-us/library/windows/desktop/ms645601(v=vs.85).aspx#_win32_XBUTTONs

Where should the default action occur. I agree with that option B is the less likely to cause the context menu issues all over again.

@jstenback
Copy link

I can't test current behavior right now but IIRC the default action of left click happens on button up rather than button down, which conceptually makes more sense to me given that just pushing the button down doesn't necessarily mean that that alone is the expected to do anything, I may push the button down, do a move operation followed by an eventual button up as opposed to actually clicking. Same argument could be had for X1 and X2, even if those are of course far less commonly used buttons...

@smaug----
Copy link
Contributor

smaug---- commented Nov 22, 2017

In general there isn't really consistency when default handling of mouse "actions" happens.
contextmenu for example is platform specific. On Windows it happens on mouseup, elsewhere it is mousedown. At least web extension authors prefer the Windows model.
If default action for pointerdown [buttons 4 or 5] was navigation, pointerup would easily end up to a different page (especially on browsers which have bfcache). So perhaps default action on *up would be better.
...but I was told that at least on Linux default action happens on button down.
And on Win7 button up, on FF and IE

@dtapuska
Copy link

Personally I'd prefer to make this a default action of the auxclick as opposed to mouseup but I guess there are situations that the auxclick doesn't get dispatched? like if the clicked node is removed from the tree and is no longer connected to the document? Perhaps we do want that behavior?

@mustaqahmed
Copy link
Member Author

Navigation being a default action in pointerdown or pointerup narrows down the "scope" of canceling navigations, which could be better in terms of not breaking current users' expectations. Otherwise, navigation would be cancelled through canceling any of {pointerdown, pointerup, auxclick}.

Between pointerdown and pointerup, pointerup seems a safer choice because it's perhaps reasonable to assume that canceling pointerdown is more common than canceling pointerup.

Do we have any data on how popular "forward/back buttons for navigation" is? Or what fraction of websites cancel pointerup events? If the product of these two numbers is small, the change should be safe.

@dtapuska
Copy link

dtapuska commented Dec 1, 2017

I think we need to update the UIEvent spec to contain these button definitions. And I don't see why putting it on pointerup is any better than mouseup. Cancelling the pointerup will still prevent the default behavior.

@patrickhlauke
Copy link
Member

@dtapuska mentions the UIEvent spec...is this a case where we can/should defer decisions here to that spec (i.e. not something to define directly in PE)?

@patrickhlauke
Copy link
Member

patrickhlauke commented Feb 3, 2021

Discussed in PEWG today. Decided to close this for now, as this feels out of scope purely for PE. There's inconsistency at the moment between platforms on when things happen when these buttons are pressed (on the down, or on the up), and they don't currently fire any other events like mouse events(?). So this needs to be discussed more fundamentally first (in UI Events?). If something comes from discussion there, we can revisit to see if events should be pointer events or not (or some more high-level abstract event like contextmenu)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants