Browse Source

fix: preventDefault mousedown on data-tauri-drag-region, closes #4059

Lucas Nogueira 3 years ago
parent
commit
a0e20621f5
2 changed files with 6 additions and 0 deletions
  1. 5 0
      .changes/tauri-drag-region-prevent-default.md
  2. 1 0
      core/tauri/scripts/core.js

+ 5 - 0
.changes/tauri-drag-region-prevent-default.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Call `preventDefault()` in the mousedown event handler for `[data-tauri-drag-region]` elements.

+ 1 - 0
core/tauri/scripts/core.js

@@ -134,6 +134,7 @@
   // drag region
   document.addEventListener('mousedown', (e) => {
     if (e.target.hasAttribute('data-tauri-drag-region') && e.buttons === 1) {
+      e.preventDefault()
       // start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it
       window.__TAURI_INVOKE__('tauri', {
         __tauriModule: 'Window',