Skip to content

Conversation

@GreenJuanYT
Copy link

No description provided.

google-labs-jules bot and others added 4 commits May 25, 2025 10:06
Previously, the Textbox input for name, year, and the designation list
did not trigger the keyboard on mobile devices. This was because these
inputs were custom-implemented using canvas drawing and JavaScript-based
event handling, which doesn't inherently trigger the mobile keyboard.

This commit introduces a hidden HTML input element that is focused
when a canvas-based input is selected. The native mobile keyboard
interacts with this hidden input, and its value is synchronized
with the canvas input, enabling text entry on mobile devices.

Changes include:
- Added a hidden text input to index.html.
- Modified ui.js to:
  - Focus/blur the hidden input when canvas inputs are focused/blurred.
  - Synchronize text between the hidden input and the canvas input.
  - Set maxLength property on the hidden input.
The virtual keyboard was not consistently appearing on mobile devices for text inputs that are custom drawn and rely on a hidden HTML input element.

This was addressed by:
1. Modifying the `hidden-input` element's CSS in `index.html` to be `opacity:0` and `z-index:-1` but still technically part of the layout (1x1 pixel), instead of being positioned far off-screen. This makes it more readily focusable.
2. Adjusting the `clickFunc` in `ui.js` for these custom input elements. Before focusing the `hidden-input`, its `opacity` is temporarily set to a near-zero value (0.00001) and its `zIndex` is increased. After the focus attempt, these styles are immediately reverted.

This approach helps ensure mobile browsers recognize the focus event as legitimate for bringing up the virtual keyboard for the `yearselbox`, `prefix_box`, `suffix_box`, and `name_edit_box` components.
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