Custom Behaviour progress with Android keyboard entry

I have an input field for entering someone's name and would love to have it progress a timeline as people input letters.

I have keyboard presses working well with a physical keyboard entry using -

if (event.keyCode === 32) { // the SPACEBAR key
    hypeDocument.triggerCustomBehaviorNamed('spacebar')
};	

My problem is that on mobile and it's a screen keyboard this doesn't seem to work. I'm trying this on android particularly.

I'm not sure if there is a different set of keyboard codes for software keys or it will never work. Other thought is having it run a custom behaviour as the input box receives, um, input.

As I start trawling the sea of javascripts I thought I'd pose the question here first.

Not quite instantly answering my question but apparently Android keyboards pass keycode 229 for all presses. As such this code works to run a custom behaviour. Not exactly what I needed but think I can work with it.

if (event.keyCode === 229) { // the Android keyboard fix
    hypeDocument.triggerCustomBehaviorNamed('movefwd')
};

This post at Stackoverflow helped.

1 Like