I try to detect a middle mouse button click on a HTML Custom Element by adding a listener for the auxclick
-Event to it. As long as the page is not scrollable, this works totally fine in Chrome on a Win 10 machine.
As soon as the page is scrollable however, the event is not fired anymore and the standard bahavior of a middle click kicks in (scrolling the page by moving the mouse).
Does anyone know a way to work around this issue?
I've created a small CodePen to demonstrate the behavior.
Without scrolling it just works fine, but if you uncomment line 2 in the CSS pane (min-height: 200vh;
) the middle click triggers the scrolling behaviour.