Got the solution but with a warning.
The 'charCode' property of a keydown event should not be used. The value is meaningless.
Solution:
Use edittype: custom.
In the custom element set the input box style to position: relative and z-index higher than that of modal.