File tree Expand file tree Collapse file tree 2 files changed +31
-8
lines changed Expand file tree Collapse file tree 2 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,15 @@ function Radio<T extends RadioValue>({
4141 role = "radio"
4242 aria-checked = { isSelected }
4343 aria-disabled = { disabled }
44- className = { classnames ( 'focus-visible-ring rounded-lg px-3 py-2 grow' , {
45- 'bg-grey-2' : isSelected ,
46- 'hover:bg-grey-1' : ! isSelected && ! disabled ,
47- 'opacity-70' : disabled ,
48- 'cursor-pointer' : ! disabled ,
49- } ) }
44+ className = { classnames (
45+ 'focus-visible-ring rounded-lg px-3 py-2 grow group' ,
46+ {
47+ 'bg-grey-3/50' : isSelected ,
48+ 'hover:bg-grey-3/25' : ! isSelected && ! disabled ,
49+ 'opacity-70' : disabled ,
50+ 'cursor-pointer' : ! disabled ,
51+ } ,
52+ ) }
5053 data-value = { value }
5154 onClick = { ! disabled ? ( ) => onChange ( value ) : undefined }
5255 onKeyDown = {
@@ -66,7 +69,14 @@ function Radio<T extends RadioValue>({
6669 { children }
6770 </ div >
6871 { subtitle && (
69- < div className = "pl-4 ml-1.5 mt-1 text-grey-6 text-sm" > { subtitle } </ div >
72+ < div
73+ className = { classnames ( 'pl-4 ml-1.5 mt-1 text-sm' , {
74+ 'text-grey-7' : isSelected ,
75+ 'text-grey-6 group-hover:text-grey-7' : ! isSelected && ! disabled ,
76+ } ) }
77+ >
78+ { subtitle }
79+ </ div >
7080 ) }
7181 </ div >
7282 ) ;
Original file line number Diff line number Diff line change @@ -183,6 +183,19 @@ describe('RadioGroup', () => {
183183
184184 it (
185185 'should pass a11y checks' ,
186- checkAccessibility ( { content : createComponent } ) ,
186+ checkAccessibility ( [
187+ {
188+ name : 'no selected item' ,
189+ content : createComponent ,
190+ } ,
191+ {
192+ name : 'selected item' ,
193+ content : ( ) => createComponent ( { selected : 'one' } ) ,
194+ } ,
195+ {
196+ name : 'selected item with subtitle' ,
197+ content : ( ) => createComponent ( { selected : 'four' } ) ,
198+ } ,
199+ ] ) ,
187200 ) ;
188201} ) ;
You can’t perform that action at this time.
0 commit comments