Repository navigation
feat: Focus navigation, stick pointer and a better keyboard - #2
Conversation
|
/codex-review |
There was a problem hiding this comment.
Codex Code Review
❌ 1 blocking finding (P0, P1).
The diff introduces a blocking keyboard-state bug during cached history navigation, plus two input-handling issues. ARM64 builds and device behavior could not be validated in this read-only environment.
Reviewed head a99f7df85f1f7c30d2946bfc8c2fb6fa578fb8c3. Push changes, then comment a new review request to review the new head.
| (void)event; | ||
| sync_view(browser); | ||
| if (event == WEBKIT_LOAD_COMMITTED) { | ||
| browser->keyboard = FALSE; |
There was a problem hiding this comment.
[P1] Resynchronize overlay state after restoring a cached page.
Returning to a cached address screen restores its open keyboard, but this handler resets the native keyboard flag. Cached documents do not rerun DOMContentLoaded, so the overlay never republishes its state: D-pad and face buttons perform browser actions instead of operating the visible keyboard. Republish keyboard and focus state on persisted pageshow or explicitly request it after restoration, and cover back/forward navigation in the smoke test.
| { | ||
| (void)fd; | ||
| Pad *pad = data; | ||
| if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { |
There was a problem hiding this comment.
[P2] Clear controller state when its input device disconnects.
Disconnecting a controller while a direction or stick is held removes its FD source without clearing the repeat timer or stored axes. Since no release event arrives, navigation, deletion, pointer movement, or scrolling can continue indefinitely. Track active input ownership per pad and cancel its repeats and axis state on both disconnect paths.
| g_autoptr(WebKitUserContentManager) content = webkit_user_content_manager_new(); | ||
| g_autofree char *script_source = g_strconcat("globalThis.GIZLET_LANG = \"", chinese ? "zh-CN" : "en", "\";\n", | ||
| overlay_source, NULL); | ||
| WebKitUserScript *script = webkit_user_script_new_for_world(script_source, WEBKIT_USER_CONTENT_INJECT_TOP_FRAME, |
There was a problem hiding this comment.
[P2] Support keyboard activation for fields inside frames.
The overlay runs only in the top frame, so focusing a field inside an iframe produces no editable-focus message. The top document sees the iframe as its active element; A therefore sends Enter rather than opening the keyboard, and pointer clicks cannot open it either. Embedded login and search forms cannot be filled using handheld controls. Add isolated-world focus and editing support for the focused frame, including a cross-origin iframe test.
|
/codex-review |
There was a problem hiding this comment.
Codex Code Review
✅ No blocking findings (2 non-blocking).
The full diff contains two actionable focus-handling gaps in the new keyboard integration. JavaScript and shell syntax checks passed; ARM64 packaging and WebKit runtime tests were unavailable in this checkout.
Reviewed head 7662cb752377d8e22f79b9a52edc891e1079cc0e. Push changes, then comment a new review request to review the new head.
| : g_str_equal(kind, "frame") ? FOCUS_FRAME : g_str_equal(kind, "other") ? FOCUS_OTHER : FOCUS_NONE; | ||
| } else if (g_str_has_prefix(message, "subfocus:")) { | ||
| const char *kind = message + strlen("subfocus:"); | ||
| browser->frame_text = g_str_has_prefix(kind, "text"); |
There was a problem hiding this comment.
[P2] Synchronize top-level focus when a frame reports text focus.
When navigation moves focus into an iframe field without clicking, the child reports subfocus:text, but this handler only updates frame_text. Focus events inside the frame do not bubble to the parent, so browser->focus can remain FOCUS_NONE or FOCUS_OTHER. A then sends Enter instead of opening the keyboard because press() also requires FOCUS_FRAME. Synchronize the parent's active-element state on subframe focus changes and add coverage for entering a frame with the D-pad.
| }; | ||
| const target = () => { | ||
| if (start) return document.getElementById("address"); | ||
| const element = document.activeElement; |
There was a problem hiding this comment.
[P2] Resolve text fields inside shadow roots.
For an input inside a web component's shadow root, document.activeElement is the component host, and the window's focusin event is also retargeted to that host. Consequently, the overlay classifies the field as non-editable and cannot open its keyboard through either A or a pointer click. Resolve the actual focused control through open shadow roots and use the event's composed path when identifying focus targets.
|
/codex-review |
There was a problem hiding this comment.
Codex Code Review
✅ No blocking findings (2 non-blocking).
Found two input and display regressions worth fixing. The ARM64 build and smoke test were not run in this read-only checkout.
Reviewed head bf10a523e948b5811a2f8ff06a2d2d5d3420ce2b. Push changes, then comment a new review request to review the new head.
| extern "C" fn browser_button(code: u16, swap: bool) -> c_int { | ||
| let (a, b) = if swap { (BTN_SOUTH, BTN_EAST) } else { (BTN_EAST, BTN_SOUTH) }; | ||
| let button = match code { | ||
| 0x220 => Button::Up, |
There was a problem hiding this comment.
[P2] Previously supported D-pad key codes are now ignored.
Pads emitting KEY_UP, KEY_DOWN, KEY_LEFT, and KEY_RIGHT (103/108/105/106) now map every direction to Button::None. These devices were explicitly supported before this change; open_pads() still accepts them, and the HAT handler cannot compensate when they emit no HAT events. Restore the key-code aliases alongside the BTN_DPAD_* mappings.
| index = (guint)CLAMP((int)index + step, 0, (int)G_N_ELEMENTS(levels) - 1); | ||
| else | ||
| index = 4; | ||
| webkit_web_view_set_zoom_level(browser->web, levels[index]); |
There was a problem hiding this comment.
[P2] Page zoom pushes the keyboard outside the handheld display.
The overlay shares the document's zoom, and that zoom persists when X opens the address screen. At 200% on the R36S's 640×480 display, the viewport is only 320×240 CSS pixels, while the keyboard's six fixed-height rows, padding, and hints exceed that height. The keyboard covers the address field and clips its upper keys; zoom controls are then intercepted as keyboard actions. Keep the overlay independent of page zoom, or resize it to fit, and verify the address screen at the supported zoom levels.
## Summary Follow-up to #2, from its Codex review. - Gamepads that report the D-pad as `KEY_UP`, `KEY_DOWN`, `KEY_LEFT` and `KEY_RIGHT` move focus again, as they did in #1. - The on-screen keyboard, toasts and pointer counter-scale the page zoom, so the keyboard keeps its size and fits the 640×480 screen at 200%. ## Validation The ARM64 smoke test adds a step that zooms to 200% with the keyboard open and checks that its on-screen height is unchanged. ## Smoke test on the handheld The smoke test had only run in CI. On an R36S (192.168.4.254) it failed every time at step 5: `scrollY` is read 600 ms after a single scroll event, and on the handheld the position arrives about 3 s later. A failing check is now retried every 250 ms, up to 16 times. A full run takes about 36 s there, so the deadline is now 90 s instead of 40 s. With these changes all 17 steps pass on the device.
Summary
https://,www.,.com,.cn,/and:shortcuts, a symbol layer, shift, caret movement with L1/R1, and a preview of the field. It also types into page fields. Text that is not an address searches Bing. Labels follow the Launcher language.Validation