Repository navigation
feat(dioxus-native-dom): add constructors and re-exports for NativeWheelData, NativeScrollData, NativeTouchData, and NativeFocusData - #1760
Merged
nicoburns merged 1 commit intoNov 25, 2026
Conversation
…eWheelData, NativeScrollData, NativeTouchData, and NativeFocusData
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
In a Dioxus Native application hosting a custom
<object>Widget(or testing Dioxus Native event handlers in isolation), the embedder bridges host wheel/scroll/touch/focus events into Dioxus event handlers (onwheel,onscroll,ontouch*,onfocus).Problem
When
DioxusDocumentinstallsNativeConverter,convert_wheel_data,convert_scroll_data, andconvert_touch_datadowncastPlatformEventDatatoNativeWheelData,NativeScrollData, andNativeTouchDatavia.unwrap(). Although #1658 re-exportedNativeWheelData, its innerBlitzWheelEventfield remainspub(crate)with no public constructor. Likewise,NativeScrollDataandNativeTouchDatahavepub(crate)fields with no constructor, andNativeScrollData,NativeTouchData, andNativeFocusDataare not re-exported at the crate root. As a result, custom widgets cannot constructPlatformEventDataforonwheel/onscroll/ontouch*without panicking onNativeConverter.Related: #1494, #1658.
Investigation & References
dioxus-native-domre-exports:packages/dioxus-native-dom/src/lib.rs#L17-L21NativeTouchData(#L495),NativeFocusData(#L575),NativeScrollData(#L583),NativeWheelData(#L618-L632):packages/dioxus-native-dom/src/events.rs#L495-L632DioxusEventHandlerevent wrapping:packages/dioxus-native-dom/src/dioxus_document.rs#L330-L346dioxus-htmltyped & platform event constructors:WheelData::new,PlatformEventData::newWheelEventconstructor: W3C UI Events §WheelEventNativePointerData::new— intentionally untouched here to avoid merge conflicts).Decision
Expose
pub fn new(...) -> SelfonNativeWheelData,NativeScrollData, andNativeTouchData, and re-exportNativeFocusData,NativeScrollData, andNativeTouchDataalongsideNativeWheelDataindioxus_native_dom:Self(matching #1658 and #1566) preservesHasWheelData/HasScrollData/HasTouchData/HasFocusDatatrait implementations so embedders and tests can construct eitherWheelData::new(NativeWheelData::new(ev))orPlatformEventData::new(Box::new(NativeWheelData::new(ev))).mainto stay conflict-free with open PRs #1566, #1277, and #1672.380220bf5.WPT results
No changes in test results compared to
main.Generated by the WPT workflow.