styled-components / xstyled

A utility-first CSS-in-JS framework built for React. 💅👩‍🎤⚡️
https://xstyled.dev
MIT License
2.27k stars 106 forks source link

fix(system): add aria-disabled to the disabled state #297

Closed AlfonzAlfonz closed 3 years ago

AlfonzAlfonz commented 3 years ago

xstyled has disabled state which allows to style elements which support disabled attribute, unfortunately if I want to render button as an link I need to use "aria-disabled" attribute. Solution is straightforward, change the disabled state so it includes &[aria-disabled=true]. I know that I can make the change locally in the theme, but I think it is important to include it in the library.

Summary

Chakra ui has similar concept to the states and their implementation of disabled includes. https://chakra-ui.com/docs/features/style-props#pseudo

Test plan

netlify[bot] commented 3 years ago

‼️ Deploy request for xstyled rejected. Learn more about Netlify's sensitive variable policy

🔨 Explore the source changes: 4cc2a74d8feebde01fdb1f6e8cfb6ab0215ad154

codecov[bot] commented 3 years ago

Codecov Report

Merging #297 (4cc2a74) into main (250d21f) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #297   +/-   ##
=======================================
  Coverage   92.74%   92.74%           
=======================================
  Files          60       60           
  Lines        1255     1255           
  Branches      244      244           
=======================================
  Hits         1164     1164           
  Misses         91       91           
Impacted Files Coverage Δ
packages/system/src/defaultTheme.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 250d21f...4cc2a74. Read the comment docs.

agriffis commented 3 years ago

unfortunately if I want to render button as an link I need to use "aria-disabled" attribute

Could you explain this?

AlfonzAlfonz commented 3 years ago

Yeah, here is a simple use case. Sometimes I need to create button, but I can't use the button element and if I want to make it disabled I need to use aria-disabled attribute.

https://codesandbox.io/s/angry-matsumoto-huzym?file=/src/App.js

gregberge commented 3 years ago

Hello @AlfonzAlfonz, can you update documentation? I think there is a page where it is described.

AlfonzAlfonz commented 3 years ago

Docs should be updated now :)

gregberge commented 3 years ago

Thanks!