mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +01:00
Fix right-click on downtime activities on macOS.
On macOS with a single-button mouse (e.g. a laptop trackpad) it's common to trigger a right-click with ctrl+click. In Chrome, this triggers both a `contextmenu` event and a regular `click` event. In the context of downtime actions, this meant that we were deselecting an action in the `contextmenu` handler but then immediately re-selecting it again in the `click` handler. This commit works around the problem by stopping the event from propagating further. This fixes the bug, but also stops Foundry's default `contextmenu` handler from firing and preventing the browser context menu from appearing, so we also have prevent the event's default behaviour from firing.
This commit is contained in:
parent
7b820d4c60
commit
d60a6d2e08
1 changed files with 12 additions and 0 deletions
|
|
@ -119,6 +119,18 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
: 0;
|
||||
|
||||
this.render();
|
||||
|
||||
// On macOS with a single-button mouse (e.g. a laptop trackpad),
|
||||
// right-click is triggered with ctrl+click, which triggers both a
|
||||
// `contextmenu` event and a regular click event. We need to stop
|
||||
// event propagation to prevent the click event from triggering the
|
||||
// `selectMove` function and undoing the change we just made.
|
||||
event.stopPropagation();
|
||||
|
||||
// Having stopped propagation, we're no longer subject to Foundry's
|
||||
// default `contextmenu` handler, so we also have to prevent the
|
||||
// default behaviour to prevent a context menu from appearing.
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
static async takeDowntime() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue