New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change drag-region
to data attribute
#1656
Comments
@lucasfernog Working <div data-tauri-drag-region className="title-panel">
</div> Not working <div data-tauri-drag-region className="title-panel">
<div className="uk-text-small uk-text-muted p-n">
<p id="text-title">
App Title
</p>
</div>
</div> |
Hey @jecsham can you file an issue so we don't forget about this? |
Sure, I will prepare one |
No need for a new issue. We already tried fixing it, but it's actually not possible without breaking stuff. So instead you always need to add the attribute to the actual click target(s) (most of the time it's the innermost element(s). ref: #3031 |
I tried using this attribute, but gave up after playing whack-a-mole with adding Tried a few options until I found something that works fantastic for me: import { window as tauriWindow } from "@tauri-apps/api";
// ...
const noDragSelector = "input, a, button"; // CSS selector
document.addEventListener("mousedown", async e => {
if (e.target.closest(noDragSelector)) return; // a non-draggable element either in target or its ancestors
await tauriWindow.appWindow.startDragging();
}); This solution technically has the opposite issue - playing whack-a-mole with interactive elements, but, this is a much easier task in practice. I can't speak for all apps, but it may be worth considering for Tauri. For instance, we could make use of the (currently unused) attribute value to provide the above mentioned behavior: <div data-tauri-drag-region> works exactly like it does today </div>
<div data-tauri-drag-region="input, a, textarea"> custom no-drag selector </div>
<div data-tauri-drag-region="default"> some sensible default no-drag-selector </div> |
Hi, have your solved this problem? |
As a quick fix you could put the <div data-tauri-drag-region className="title-panel">
<div data-tauri-drag-region className="uk-text-small uk-text-muted p-n">
<p data-tauri-drag-region id="text-title">App Title</p>
</div>
</div> |
thanks |
Using Angular, placing Didn't the drag region used to be a CSS class? |
|
Enabling |
Currently the draggable region is marked with a class (
drag-region
) but we've been discussing on Discord about changing to be a data attribute instead.The text was updated successfully, but these errors were encountered: