Prevent duplicate tap events (#436)
* prevent duplicate click events on mobile * prevent duplicate mouse events on mobile safari * only prevent default event on links I think I misunderstood what was going on originally, mouse and click weren't both triggering it was the default event from the a reference. So, only prevent default behavior on a e;ements, since default handlers are needed on navigation. Oddly, this I've only noticed this fixing navigation on firefox simulator. It wasn't needed on firefox.
This commit is contained in:
parent
629d25e0e3
commit
fee2c5928e
@ -971,6 +971,14 @@ export class Editor {
|
||||
if (touchCount === 0) {
|
||||
safeRun(async () => {
|
||||
const touch = event.changedTouches.item(0)!;
|
||||
if (!event.altKey && event.target instanceof Element) {
|
||||
// prevent the browser from opening the link twice
|
||||
const parentA = event.target.closest("a");
|
||||
if (parentA) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
const clickEvent: ClickEvent = {
|
||||
page: pageName,
|
||||
ctrlKey: event.ctrlKey,
|
||||
@ -986,6 +994,7 @@ export class Editor {
|
||||
}
|
||||
touchCount = 0;
|
||||
},
|
||||
|
||||
mousedown: (event: MouseEvent, view: EditorView) => {
|
||||
safeRun(async () => {
|
||||
const pos = view.posAtCoords(event);
|
||||
|
Loading…
Reference in New Issue
Block a user