No public way to dispatch a DOM event (e.g. a synthetic keydown) through DioxusDocument

Open
#1,494 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
api, frontend

Research direction

Start by tracing DioxusDocument and its event driver, then read synthetic_click_event, synthetic_form_event, BlitzKeyboardData, and DioxusEventHandler to understand the existing paths. Compare the proposed public dispatch API with delivering keyboard UiEvents to the focused node; done means app handlers and Blitz default actions both receive the synthetic event.

Written by the indexing model from the issue text.

Description

A-Dioxus-Native A-Events C-Usability

There's no public way to send a DOM event through a DioxusDocument's event driver, so that both the app's Dioxus handlers and Blitz's default actions run. An example is a key press from an app's own input layer, such as gamepad navigation or an on-screen keyboard. synthetic_click_event and synthetic_form_event build Dioxus event payloads, but nothing builds keyboard ones (BlitzKeyboardData is pub(crate)). The handler that bridges the driver to the VirtualDom (DioxusEventHandler) isn't exported. Document::handle_ui_event only takes UiEvents from the shell, which go through hit testing.

An app that moves focus itself, with a gamepad say, can't make the focused control receive the keydown a real key would send. So every control needs a second, non-DOM path for the same action.

Possible shape: a public DioxusDocument::dispatch_event(target: NodeId, data: DomEventData) that runs the event driver, or keyboard UiEvents delivered to the focused node as they are now, plus a public constructor for them.

Dominant language
Rust
Stars
4.5k
Forks
281
Avg merge
6h 6m
Merged PRs (30d)
184

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DioxusLabs/blitz

All issues in DioxusLabs/blitz

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.