From dfd05441c761b1737e29794ab1f02e41e5d7cc12 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Wed, 29 May 2024 18:20:05 +0300 Subject: [PATCH] Revert "feat(core): add `app-region: drag` to `data-tauri-drag-region` (#9789)" (#9860) * Revert "feat(core): add `app-region: drag` to `data-tauri-drag-region` (#9789)" This reverts commit ae6b13dfc0590dcaedbdb619c148072f072df050. * Update pre.json * change files * Discard changes to .changes/pre.json --- .changes/revert-app-region-drag.md | 7 +++++++ core/tauri/src/window/scripts/drag.js | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changes/revert-app-region-drag.md diff --git a/.changes/revert-app-region-drag.md b/.changes/revert-app-region-drag.md new file mode 100644 index 000000000..6827c2ebc --- /dev/null +++ b/.changes/revert-app-region-drag.md @@ -0,0 +1,7 @@ +--- +"tauri": patch:bug +--- + +Revert adding `app-region: drag` to HTML elements with `data-tauri-drag-region` on Windows as it has a few issues: +- Doesn't allow right click, as it will always show the system context menu on right click. +- `data-tauri-drag-region` works only if the click was on an element that has it, this allows buttons in the custom titlebar to work, however `app-region: drag` will treat the whole area as a titlebar won't even allow clicks on buttons. diff --git a/core/tauri/src/window/scripts/drag.js b/core/tauri/src/window/scripts/drag.js index 6c2fef222..a247a41bb 100644 --- a/core/tauri/src/window/scripts/drag.js +++ b/core/tauri/src/window/scripts/drag.js @@ -63,9 +63,4 @@ } }) } - if (osName === 'windows' && 'adoptedStyleSheets' in document) { - const sheet = new CSSStyleSheet() - sheet.replaceSync('*[data-tauri-drag-region] { app-region: drag; }') - document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet] - } })()