Add pointer events and focus handling for apps run in a Shadow DOM (#5627)

* [x] I have followed the instructions in the PR template

This PR handles pointer events and focus which did following changes:
- `element_from_point` and focus is now acquired from root node object
by using `get_root_node` from document or a shadow root.
- `TextAgent` is appended individually in each shadow root.

These changes handles pointer events and focus well in a web app that
are running in a shadow dom, or else the hover pointer actions and
keyboard input events are not triggered in a shadow dom.
Helpful for building embeddable/multi-view web-apps.
This commit is contained in:
Aiden
2025-02-18 18:01:07 +01:00
committed by GitHub
parent 071e090e2b
commit 43261a5396
5 changed files with 40 additions and 17 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ impl WebRunner {
{
// First set up the app runner:
let text_agent = TextAgent::attach(self)?;
let text_agent = TextAgent::attach(self, canvas.get_root_node())?;
let app_runner =
AppRunner::new(canvas.clone(), web_options, app_creator, text_agent).await?;
self.app_runner.replace(Some(app_runner));