Skip to content

Simulator: draw the native editor where the panned field is - #6133

Merged
shai-almog merged 2 commits into
masterfrom
sim-vkb-android-editor
Oct 29, 2026
Merged

shai-almog merged 2 commits into
masterfrom
sim-vkb-android-editor

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Problem

With the simulated keyboard in Android pan mode (forced, or chosen by auto for a field low on the screen), the text being typed was drawn one pan offset above the field, over whatever content sat there, while the field itself looked empty. iOS mode and Android resize mode were unaffected.

The native Swing editor's bounds are raised by the pan offset (Repainter in editStringOnAwtThread), so it sits, and takes clicks, where the panned field is drawn rather than under the keyboard. But the editor is painted into the screen raster, and composeSimulatorOverlays raises that whole raster by the same offset again. The editor moved twice.

Fix

  • C.paintChildrenIntoBuffer paints the editor lowered by the pan offset and clips it out of the regular children pass. Its bounds, and so its hit area, are unchanged.
  • The initial bounds in editString now subtract the pan offset as Repainter does, and setPanOffset repaints the editor so its bounds are recomputed on every offset change (keyboard opening, Next to another field, keyboard hiding). Without that, the frame after a change drew the editor from bounds made for the previous offset; an adversarial review of the first commit found this.

Secondary window canvases are untouched (this == canvas); a stale editor is ignored (getParent() != this).

Verification

A sign up form with the email and password fields low on a Pixel skin, driven over the simulator's MCP (sim_keyboard_set, sim_tap, sim_keyboard_type, sim_keyboard_key) and recorded with sim_record_*:

  • Android pan: before, the typed text appeared over the paragraphs above the field; after, every frame at 6 fps shows it inside the field, through the keyboard opening, Next to the password field and Done.
  • Android resize and iOS: unchanged, correct before and after.

Checked at one zoom level only. The compose step scales the pan by buffer width / screen width and this paint by zoomLevel, the same assumption the existing bounds code makes; at most about a pixel of rounding differs.

🤖 Generated with Claude Code

shai-almog and others added 2 commits October 29, 2026 18:11
In the simulated keyboard's Android pan mode the native editor's bounds are
raised by the pan offset, and the screen raster it is painted into is raised
by the same offset again when it is composed, so typed text appeared one pan
offset above the field, over unrelated content. Paint the editor lowered by
the offset into the raster and clip it out of the regular children pass; its
bounds, and so its hit area, stay where the field is drawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editor's bounds are recomputed only when it repaints, so the frame after
the keyboard opened, after Next moved to another field or after the keyboard
hid drew it from bounds made for the previous offset. Raise the initial bounds
by the offset too, and repaint the editor whenever the offset changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog
shai-almog merged commit 9bb7b17 into master Oct 29, 2026
33 of 37 checks passed
@shai-almog
shai-almog deleted the sim-vkb-android-editor branch October 29, 2026 17:18
@github-actions

Copy link
Copy Markdown
Contributor

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

@shai-almog

shai-almog commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 12 screenshots: 12 matched.
✅ JavaSE simulator integration screenshots matched stored baselines.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ✅ ByteCodeTranslator: 0 findings (no issues)
    • ✅ android: 0 findings (no issues)
    • ✅ android-compat: 0 findings (no issues)
    • ✅ android-res-compiler: 0 findings (no issues)
    • ✅ backend: 0 findings (no issues)
    • ✅ backend-test: 0 findings (no issues)
    • ✅ build-engine: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-gradle-plugin: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ compose-compat: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ desktop-compat-runtime: 0 findings (no issues)
    • ✅ fxml-compiler: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
    • ✅ javac: 0 findings (no issues)
    • ✅ javafx-compat: 0 findings (no issues)
    • ✅ project-model: 0 findings (no issues)
    • ✅ swing-compat: 0 findings (no issues)
  • ✅ PMD: 0 findings (no issues) [Report archive]
  • ✅ Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

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.

1 participant