-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
Need for synchronous PreventDefault across Tao/Wry boundary #85
Comments
fix(#60): handling default cfg & kebab_case name
from my (maybe flawed) testing in the chrome console, synthetic events still manage to have a different behaviour:
This opens a new tab and focuses it, as opposed to opening it in the background when the cmd-click is done using the real mouse |
We cannot create an event that is identical to the event triggered by the browser. Events that are triggered by a user are trusted. Events that are modified by javascript will not be trusted |
Is there any current workaround for calling prevent default on an event conditionally? I am particularly interested for desktop platform. |
Relevant Wry issue: tauri-apps/wry#454. Looks like there are potential APIs for this, but Wry has no plans to expose them. So possibilities are:
|
From the mdn docs:
It sounds like it can just be a flag on Event which is set in event handlers. We don't need to stay in lock step with the browser which makes this much easier to implement |
Unfortunately, there's no way today to conditionally call PreventDefault across the Tao/Wry boundary.
Developers should be able to disable default in a way that's not just hardcoded fields - IE allowing default behavior when right-clicking links in the browser.
The FFI boundary is particularly challenging because we cannot synchronously handle the event.
I think the solution is to always trap the event and prevent default.
Then, ff 1) the event has default behavior and 2) the user didn't prevent that default behavior in their Dioxus handler, then we should craft the event again and push it back in the real dom.
The text was updated successfully, but these errors were encountered: