There're a lot of end-user web frameworks (Bootstrap being one of them) which make links look like buttons. However these two are not the same when it comes to keyboard navigation on a page: buttons can be pushed by Space
, links will require pressing Enter
to activate.
Given the fact that h:commandLink
and h:commandButton
are functionally the same on the server side, how can I make them to behave the same when using keyboard navigation? Which basically boils down to the question how to make h:commandLink
to trigger the same action by both clicking the link and pressing the spacebar without rewriting .xhtml
sources.
In my limited knowledge, possible options are employing event listeners or writing special tag wrappers or even a custom ResponseWriter
to update each ClientBehaviorHolder
in the tree. Any ideas?