I followed the instructions here http://vaadin.com/book/-/page/advanced.shortcuts.html and I’m able to catch the enter key together with other key presses. I decided to divide my one big action handler implementation into several smaller handlers but now I’m having problems removing them from the panel.
Before building my own mechanism for this it might be better ask first: Is there a way to remove all keyboard handlers from a panel at once? Using the removeActionHandler requires me to keep list of all handlers.
I guess the removeAllComponents should go into the Action.Container interface too, as it is that which it is the interface that tells you that the component can handle actionhandlers. A getActionHandlers() would be nice too. With that you could have done a own loop through the handlers and remove them. Possibly some other scenarios too that we haven’t thought of.
removeActionHandle(Action.Handler) does a actionMapper = null; at the same time it does actionHandlers = null;. Maybe that should be in your fix too.
At least for me this patch seems pretty straightforward and welcomed addition! But should it be in Action.Container interface?
To original question: There are few places where control over listeners (action handlers in this case) requires that reference to them is needed to be maintained separately. My suggestion for a quick fix: It may be easiest to inherit the panel (inline inheritance maybe?) and add the required functionality there.