What level of simulation should be in Keyboard interactor?
For the this moment Keyboard interactor allows to type some characters and simulates keyDown and keyUp events for the most possible keys. But there might be different scenarios where Keyboard interactor doesn't work well or doesn't support at all. For example:
- Using functional keys, like
Home/End/Arrowsto move the cursor in a text field to later insert some text. Should Keyboard interactor be responsible for theselectionRageor not? - Using
Enterfor submitting a form if it is on a page. - Removing characters from a field by using
Backspace/Deletekeys. - Using
PageUp/Downfor the scrolling a page. - Supporting case with testing clipboard logic, like user selects a part of the text on page, hits
Ctrl+Cand then pastes it somewhere. Should it be specific Clipboard interactor for it? - Changing the focus by the Tab.
I mean all cases that supported by a browser in the native way, when you don't need a specific onKeyDown handler.
@wKich I think we want to support all of these cases, but I think we need to split up each one by order of difficulty. Right now with simulated keyboard events there is no default action at all because browsers never fire default actions for synthetic events. What we're talking about though is providing not only the simulated events, but also the default actions for those events which is the next level of simulation.
It would almost be like partially implementing our own user agent and the activation triggers for them.
https://w3c.github.io/uievents/#event-types-list
This might actually be simpler in the long run since it has things like the "default action" of pressing keydown is to fire the beforeInput and input events for example.
I'd vote for Enter and Tab behaviors as being the most important.