The middle click seems not to work for commandButton in JSF. At least not as expected – which would be opening the result of the action in a new tab. No submit/action is triggered.
The mouseup and mousedown events seem to work OK as the “animation” for a pressed button is working on middle click.
Middle clicks on commandLink work as expected.
How would I go about implementing a “normal” middle click behaviour for my commandButtons? How would i know on the mouseup/down events which button has been clicked?
Thank you.
I am using JSF 2 with Mojarra 2.1.7
First of all, there is no “normal” middleclick behaviour. This is unspecified in HTML and the default behaviour is browser dependent.
As to the concrete question, you could catch it in the
onclickevent. On a middle click theevent.whichwould return2. You can then set the form’s target to_blankto let it submit to a new window.Again, this will not work for some browsers.