Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use disabled CSS pseudo-class to style element with aria-disabled attributes?

I am creating a button component using aria-disabled for managing disabled state instead of disabled attribute to accommodate accessibility requirements.

Earlier I used CSS pseudo-class :disabled to style the disabled component. Is there a way to use it with aria-disabled="true" to style the button and aria-* attributes in general?

like image 873
Harshal Patil Avatar asked Nov 15 '25 07:11

Harshal Patil


1 Answers

Just apply an attribute selector instead of :disabled:

[aria-disabled="true"] { /* your declarations */ }
like image 165
connexo Avatar answered Nov 17 '25 22:11

connexo