Skip to content

fix: Allow Enter key propagation in WASM Skia TextBox for focus navigation on Android - #22299

Merged
MartinZikmund merged 6 commits into
masterfrom
copilot/fix-focus-control-android
Jan 23, 2026
Merged

MartinZikmund merged 6 commits into
masterfrom
copilot/fix-focus-control-android

Conversation

Copilot AI commented Jan 7, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue:

PR Type:

  • 🐞 Bugfix

What is the current behavior? 🤔

Focus navigation via Enter key (e.g., InputExtensions.AutoFocusNext from Uno.Toolkit) fails on Android browsers in WASM Skia applications. The invisible HTML input element used for keyboard capture calls preventDefault() on all keydown events except clipboard operations, preventing Enter key events from reaching the document-level keyboard listener. This blocks KeyDown routed events from being raised on the TextBox.

What is the new behavior? 🚀

Enter key events now propagate correctly when TextBox.AcceptsReturn="False", allowing focus navigation to work on Android browsers.

Implementation:

  • Modified BrowserInvisibleTextBoxViewExtension.ts to track acceptsReturn state
  • Skip preventDefault() for Enter key when TextBox doesn't accept returns
  • Enter key events now bubble to BrowserKeyboardInputSource, triggering KeyDown routed events

Example usage:

<TextBox Header="Field 1" utu:InputExtensions.AutoFocusNext="True" />
<TextBox Header="Field 2" utu:InputExtensions.AutoFocusNext="True" />
<TextBox Header="Field 3" />

Pressing Enter now correctly moves focus to the next field on Android browsers.

PR Checklist ✅

  • 📝 Commits follow Conventional Commits specification
  • 🧪 Tests added (existing tests validate Enter key behavior for multiline TextBoxes)
  • 📚 Docs updated (not applicable - bug fix for existing functionality)
  • 🖼️ Validated PR Screenshots Compare Test Run results
  • ❗ Contains NO breaking changes

Other information ℹ️

The fix follows the same event propagation pattern already used for clipboard operations (Ctrl+C/V/X). Only affects Enter key behavior when AcceptsReturn is false - multiline TextBox behavior unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>[WASM Skia] Focus control does not work on Android</issue_title>
<issue_description>### Current behavior 🐛

There is something wrong with element focus on WASM Skia running on Android: neither Uno InputExtensions.AutoFocusNext, InputExtensions.AutoFocusNextElement nor my own implementation of a similar attached properties work. These work fine when using the WASM Skia app on desktop browsers or iOS.

Expected behavior 🎯

Should focus next element when pressing Enter on Android in WASM Skia application.

How to reproduce it (as minimally and precisely as possible) 🔬

<TextBox Header="Test1" utu:InputExtensions.AutoFocusNext="True" />
<TextBox Header="Test2" utu:InputExtensions.AutoFocusNext="True" />
<TextBox Header="Test3" />

Workaround 🛠️

No response

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

WebAssembly

Uno.Sdk version (and other relevant versions) 📦

6.4.53, 6.5.0-dev.100

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CLAassistant

CLAassistant commented Jan 7, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ morning4coffe-dev
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform label Jan 7, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a focus navigation issue on Android for WASM Skia applications where Enter key events were being prevented from propagating, blocking features like InputExtensions.AutoFocusNext from working. The fix modifies the keyboard event handler in BrowserInvisibleTextBoxViewExtension.ts to allow Enter key events to propagate when the TextBox doesn't accept return characters.

Key Changes

  • Added a static acceptsReturn field to track whether the current TextBox accepts return characters
  • Modified onkeydown handler to skip preventDefault() for Enter key when acceptsReturn is false, allowing the event to propagate to document-level listeners

Copilot AI changed the title [WIP] Fix focus control issues on Android for WASM Skia fix: Allow Enter key propagation in WASM Skia TextBox for focus navigation on Android Jan 7, 2026
Copilot AI requested a review from Jen-Uno January 7, 2026 19:33
@Jen-Uno
Jen-Uno marked this pull request as ready for review January 7, 2026 20:21
@Jen-Uno
Jen-Uno requested a review from Copilot January 7, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 190324 has failed on Uno.UI - CI.

@Jen-Uno
Jen-Uno requested a review from ramezgerges January 7, 2026 22:27
@github-actions github-actions Bot added the area/automation Categorizes an issue or PR as relevant to project automation label Jan 11, 2026
@morning4coffe-dev
morning4coffe-dev marked this pull request as draft January 11, 2026 22:18
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 190834 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 190922 has failed on Uno.UI - CI.

1 similar comment
@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 190922 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@morning4coffe-dev
morning4coffe-dev marked this pull request as ready for review January 12, 2026 22:11
Copilot AI review requested due to automatic review settings January 12, 2026 22:11
@morning4coffe-dev

Copy link
Copy Markdown
Member

The if ((ev.key === "Enter" || ev.keyCode === 13) && !BrowserInvisibleTextBoxViewExtension.acceptsReturn) wasn't sufficient for this, listening for inputType insertLineBreak resolves the issue for Android specifically. More on this https://www.w3.org/TR/input-events-1/. Question for reviewer, should we keep both? Other platforms appeard OK even before this PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 190974 has failed on Uno.UI - CI.

@morning4coffe-dev
morning4coffe-dev force-pushed the copilot/fix-focus-control-android branch from a99a41f to 2ca9a34 Compare January 15, 2026 10:29
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 191342 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 192653 has failed on Uno.UI - CI.

@MartinZikmund
MartinZikmund merged commit 7ead8e2 into master Jan 23, 2026
53 checks passed
@MartinZikmund
MartinZikmund deleted the copilot/fix-focus-control-android branch January 23, 2026 09:39
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/automation Categorizes an issue or PR as relevant to project automation platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WASM Skia] Focus control does not work on Android

8 participants