Unanswered: Not allowing focus at a readOnly field
Currently if in a form, a field is marked as readOnly:true, then a user can focus at it though its value can not be modified.
This leads to an issue when user is navigating using tab key.
With tab key, user lands at a field which is marked as readOnly but can not modify it. Thus, what is wanted is that the user should by default be moved to the next field as in the case of disabled fields. Like, when a user is trying to focus a disabled field using tab key, then the cursor by default goes to the next allowed one, how to have the same behaviour for the readOnly fields?
The only issue with using disabled fields instead of readOnly is that the disabled fields don't get submitted to the server, which is unfortunately required.
Hence, could someone guide at how readOnly fields can be prevened from being focussed?
The code works perfectly, but unfortunately, when we change the readOnly status of field using setReadOnly(true/false) then the tabIndex still stays as -1 and field is still inaccessible using keyboard.
I tried setting tabIndex as 0 for this and also deleting tabIndex when readOnly is set to false, but no luck.
Could you guide that after changing the status of a field to setReadOnly(false) how can we make it accessible using tabIndex?