tabindex doesn't work with input disabled

Viewed 248

When Input is disabled screen reader doesn't read the input.

     <input type="text" pInputText [(ngModel)]="state" [disabled]="true"" [attr.tabindex]="0" />

I don't know why stabindex=0 doesn't work if input is disabled, because if I the input is not disabled , it works. Anyone can help me to resolve this?

1 Answers

It's because you're using the one-way data-binding syntax. In your case, you should just declare the tabindex attribute normally without the square brackets:

<input type="text" pInputText [(ngModel)]="state" disabled tabindex="0" />

Sidenote: You should also remove the data-binding for the disabled attribute: since you're already assigning it to a value of true, you might as well just declare it as you normally would - without any value.

Related