Synchronous prevent default (#2792)
* add prevent default methods to the event * sync prevent default almost working * sync prevent default working * Move event handling into the runtime * update core tests * restore desktop file dialog * implement prevent default on web * add a hint about the new prevent default method * fix web prevent default * Fix CTRL+click on links * fix values memorize in place test * Fix a few more tests * Add a playwright test for sync prevent default * Fix core doc tests * create a deprecated VirtualDom::handle_event * fix macos imports in desktop * Fix onmounted event * Fix liveview support * switch to RefCell for metadata * Remove println * remove prevent default attribute * remove web specific link behavior * Fix liveview links * more liveview fixes for link * Fix merge conflicts * Fix clippy * use the new prevent default in the file upload example
This commit is contained in:
1 parent
8b62b71e2d
commit
cab573eefd
54 files changed
+940
-729
No files matched your search
@@ -1,4 +1,5 @@
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
use dioxus_core::prelude::IntoAttributeValue;
|
||||
use dioxus_core::HasAttributes;
|
||||
@@ -215,10 +216,8 @@ mod_methods! {
|
||||
map_global_attributes;
|
||||
map_html_global_attributes_to_rsx;
|
||||
|
||||
/// Prevent the default action for this element.
|
||||
///
|
||||
/// For more information, see the MDN docs:
|
||||
/// <https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault>
|
||||
#[deprecated(note = "This attribute does nothing. For most renderers, you should prefer calling [`dioxus_core::Event::prevent_default`] on the event instead. For liveview, you can use `\"onclick\": (evt) => evt.prevent_default()` to prevent the default action for this element.")]
|
||||
/// This attribute has been deprecated in favor of [`dioxus_core::Event::prevent_default`]
|
||||
prevent_default: "dioxus-prevent-default";
|
||||
|
||||
|
||||
@@ -1746,7 +1745,12 @@ mod_methods! {
|
||||
map_svg_attributes;
|
||||
map_html_svg_attributes_to_rsx;
|
||||
|
||||
/// Prevent the default action for this element.
|
||||
/// Prevent the default action for this element. This attribute is only recommended in the LiveView renderer
|
||||
/// which does not support the prevent default method on events.
|
||||
///
|
||||
///
|
||||
/// For most renderers, you should prefer calling [`dioxus_core::Event::prevent_default`] on the event instead.
|
||||
///
|
||||
///
|
||||
/// For more information, see the MDN docs:
|
||||
/// <https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault>
|
||||
|
||||
Reference in new issue
Block a user