Skip to content

feat(dioxus-native-dom): add constructors and re-exports for NativeWheelData, NativeScrollData, NativeTouchData, and NativeFocusData - #1760

Merged
nicoburns merged 1 commit into
DioxusLabs:mainfrom
techton7:pr/dioxus-native-dom-constructors
Nov 25, 2026
Merged

nicoburns merged 1 commit into
DioxusLabs:mainfrom
techton7:pr/dioxus-native-dom-constructors

Conversation

@GoCoder7

@GoCoder7 GoCoder7 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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 DioxusDocument installs NativeConverter, convert_wheel_data, convert_scroll_data, and convert_touch_data downcast PlatformEventData to NativeWheelData, NativeScrollData, and NativeTouchData via .unwrap(). Although #1658 re-exported NativeWheelData, its inner BlitzWheelEvent field remains pub(crate) with no public constructor. Likewise, NativeScrollData and NativeTouchData have pub(crate) fields with no constructor, and NativeScrollData, NativeTouchData, and NativeFocusData are not re-exported at the crate root. As a result, custom widgets cannot construct PlatformEventData for onwheel / onscroll / ontouch* without panicking on NativeConverter.

Related: #1494, #1658.

Investigation & References

Decision

Expose pub fn new(...) -> Self on NativeWheelData, NativeScrollData, and NativeTouchData, and re-export NativeFocusData, NativeScrollData, and NativeTouchData alongside NativeWheelData in dioxus_native_dom:

  • Returning concrete Self (matching #1658 and #1566) preserves HasWheelData / HasScrollData / HasTouchData / HasFocusData trait implementations so embedders and tests can construct either WheelData::new(NativeWheelData::new(ev)) or PlatformEventData::new(Box::new(NativeWheelData::new(ev))).
  • Scoped strictly to types already on main to stay conflict-free with open PRs #1566, #1277, and #1672.
  • Early-adopted and verified locally in fork commit 380220bf5.

WPT results

No changes in test results compared to main.

Generated by the WPT workflow.

…eWheelData, NativeScrollData, NativeTouchData, and NativeFocusData
@nicoburns
nicoburns merged commit 3e7d1d1 into DioxusLabs:main Nov 25, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants