You are running into an edge case.
When the focus is on the TextInput, then the Keyboard object no longer handles keyboard input, instead Construct is allowing the browser to take control. Handling the interaction between the keyboard and a text input is surprisingly difficult (if you want it to work as users expect it should work that is), so instead of reinventing the wheel, we just let the browser do it's thing and for most cases it's the right thing to do, just let the user type normally.
To do what you describe, you have to get a little bit clever though...
The first thing I noticed is that after making the input visible, focusing it wasn't working for me, so I included a very short wait to make sure it worked.
The unintuitive part is hiding the input, to do so I did a couple of things:
- Use a trigger that responds to changes in the input.
- Use a regular expression to check if the last character of the input is the one I am interested in. In this case the regular expression "'$" does just that. The $ is checking it is the end of the string. "gi" are regular expression flags indicating the match should be global (g) and case insensitive (i), I don't think any of those matter for this contrived example.
- Make sure to remove the "'" from the string in the action block, because I imagine you don't want it to be written in the text input.