1
votes

I want to disable focus for button in composite component. I have a component that looks like this: enter image description here

When I'm pressing the "Tab" key, first the inputText component is focused, then the commandButton component is focused. What I want is to have focused only the inputText. How can I achieve this?

1
I would try tabindex="-1", dont have time to try it myself now tho :(Aksel Willgert
Thanks, it works. Could you please reply with an answer so that I can accept your solution?miro

1 Answers

2
votes
 <h:commandButton ... tabindex="-1">

The attribute tabindex defines in which order the component will be selected in the tab cycle. Documentation for h:commandButton states for attribute tabindex:

Position of this element in the tabbing order for the current document. This value must be an integer between 0 and 32767

But i guess above can be ignored, as on the other hand w3c states (for html5):

If the value is a negative integer

The user agent must set the element's tabindex focus flag, but should not allow the element to be reached using sequential focus navigation