Skip to content

Implement keyboard.show for html5 - #1537

Open
RblSb wants to merge 2 commits into
Kode:mainfrom
RblSb:html5-virt-keyboard
Open

Implement keyboard.show for html5#1537
RblSb wants to merge 2 commits into
Kode:mainfrom
RblSb:html5-virt-keyboard

Conversation

@RblSb

@RblSb RblSb commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

keyboard.show() now creates hidden focused input html element to show virtual keyboard, resends keydown/up events to game canvas and generates direct keypress events when input value updated.

canvas.onkeypress = keyPress; is removed for simplification, key presses are generated from keydown events like so:

keyboard.sendDownEvent(keyCode);
if (event.key.length == 1) {
	keyboard.sendPressEvent(event.key);
}

Using event.key instead of old event.which should be good, it's seems like a standard way to catch keypresses now and works since IE9.

I also added these small fixes while testing:

  • keycodeToChar is removed (very dead code)
  • MobileWebAudio._context == null check to fix ios simulator crash on first click when mobile web audio is enabled
  • Do not remove all iosTouchs on pointer cancel event and do not set iosTouchs[-1] = -1; accidentally
  • Explicit key.toInt() inline method, that should be useful to compare or save key values

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