[test] prevent contextmenu when only polyfilled

This commit is contained in:
kwaroran
2023-06-18 22:16:10 +09:00
parent aab32c5b09
commit c7d74b4127
2 changed files with 11 additions and 2 deletions

View File

@@ -312,6 +312,14 @@
return false
}
const preventIfPolyfilled = (e:Event) => {
if(globalThis.polyfilledDragDrop){
e.preventDefault()
e.stopPropagation()
return false
}
}
onDestroy(unsub);
</script>
@@ -348,7 +356,7 @@
on:dragover={avatarDragOver}
on:drop={(e) => {avatarDrop({index:ind}, e)}}
on:dragenter={preventAll}
on:contextmenu={preventAll}
on:contextmenu={preventIfPolyfilled}
>
<SidebarIndicator
isActive={char.type === 'normal' && $selectedCharID === char.index && sideBarMode !== 1}
@@ -417,7 +425,7 @@
on:dragover={avatarDragOver}
on:drop={(e) => {if(char.type === 'folder'){avatarDrop({index: ind, folder:char.id}, e)}}}
on:dragenter={preventAll}
on:contextmenu={preventAll}
on:contextmenu={preventIfPolyfilled}
>
<SidebarIndicator
isActive={$selectedCharID === char2.index && sideBarMode !== 1}

View File

@@ -12,6 +12,7 @@ export function polyfill() {
if((!supports) || isIos){
console.log('polyfiled dragdrop')
globalThis.polyfilledDragDrop = true
dragPolyfill({
// use this to make use of the scroll behaviour
dragImageTranslateOverride: scrollBehaviourDragImageTranslateOverride,