Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

if any input or contenteditable on the page has focus, the mobile keyboard should appear. even if that input is invisible.

and then you can catch those events just like any other.



Well, the trick is then processing those events. For `input` events it's fairly straightforward, put the character on the screen. But IMEs can also issue a composition event sequence, and it's not obvious how to handle those in a sensible way. If you wait for `compositionend`, then nothing will be visible until the composition is done. The usual thing is to overwrite each time with the current state from `compositionupdate` events, but in this case that requires moving the cursor backwards.

Perhaps the cursor could pause during a composition event?

For testing, you can easily generate composition events from a Mac keyboard, e.g.

1. Press option-e and observe an acute accent with an underline: ´ 2. Press a vowel and observe the lone accent transform into the accented character: é


This was going to be my suggestion as well. Put a proper input on the page but move it off screen or hide it with css.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: