Our app has an odd bug where if the user holds down the backspace key (for instance - when deleting a long string), the browser will rarely but occasionally go back... as if the user clicked the back button on the browser.
My question is.... how can I try to intercept the Backspace key? I know it may / may not work for all browsers but that is fine.
I've searched up and down and can't find a reliable solution.
Page.setEvent() isn't a valid API call so I can't do it there.
Page.registerKey() doesn't work because it doesn't have anything to do with events so I can't cancel an event before it reaches the browser. This just seems to be a hook for doing something on a keypress but without being able to cancel the event, the browser still gets the keypress eventually.
FormItems don't have a setDefaultProperties() API call so I'm unable to add a keyPressHandler to all FormItems by default. This means this eventhandler would have to manually be added to every TextItem or TextAreaItem manually - not really a viable solution at this point.
DynamicForm has addItemKeyPressHandler which almost gets us there. The problem is, canceling the event there also cancels it for the FormItem itself... despite the docs appearing to me that it would not. It seems like the wording does exactly what I need... allows the FormItem to process the event and then bubble it up to the Form itself where I can cancel it.
Thoughts?
My question is.... how can I try to intercept the Backspace key? I know it may / may not work for all browsers but that is fine.
I've searched up and down and can't find a reliable solution.
Page.setEvent() isn't a valid API call so I can't do it there.
Page.registerKey() doesn't work because it doesn't have anything to do with events so I can't cancel an event before it reaches the browser. This just seems to be a hook for doing something on a keypress but without being able to cancel the event, the browser still gets the keypress eventually.
FormItems don't have a setDefaultProperties() API call so I'm unable to add a keyPressHandler to all FormItems by default. This means this eventhandler would have to manually be added to every TextItem or TextAreaItem manually - not really a viable solution at this point.
DynamicForm has addItemKeyPressHandler which almost gets us there. The problem is, canceling the event there also cancels it for the FormItem itself... despite the docs appearing to me that it would not. It seems like the wording does exactly what I need... allows the FormItem to process the event and then bubble it up to the Form itself where I can cancel it.
Thoughts?
Comment