taleden / EDSY

EDSY is a web-based ship outfitting simulator tool for the game Elite Dangerous
22 stars 7 forks source link

Fix secondary clicks not activating button styles #7

Closed kestrel-one closed 2 years ago

kestrel-one commented 2 years ago

Workaround for :active pseudo-selector not being applied to right-click events. Per the CSS spec, only holding down the primary mouse button should apply the :active pseudo-selector. Our workaround is to wrap the mouse down event with the code below. It'll find the button being pressed and add an active CSS class that we can use in our CSS.

See: https://bugs.chromium.org/p/chromium/issues/detail?id=966255

kestrel-one commented 2 years ago

Discussed and decided to hold off for now. It's a pretty nasty hack to fix a minor issue. If people report it as a problem we can resurrect it.

Note for later if we do:

Taleden: I might be inclined to only register the window.mouseup inside the mousedown and have it unregister itself, so we're not catching every single mouseup on the whole page all the time Kestrel: ooh, i like that. keeps the hack more self contained as well.