@@ -14,7 +14,7 @@ import type {
1414 OptionProps ,
1515} from "react-select" ;
1616import type { SizeProps , ThemeObject } from "../types" ;
17- import { useSize } from "../utils" ;
17+ import { cleanCommonProps , useSize } from "../utils" ;
1818
1919const alignToControl = ( placement : CoercedMenuPlacement ) => {
2020 const placementToCSSProp = { bottom : "top" , top : "bottom" } ;
@@ -118,6 +118,7 @@ export const MenuList = <
118118
119119 return (
120120 < Box
121+ role = "listbox"
121122 { ...innerProps }
122123 className = { cx (
123124 {
@@ -259,7 +260,10 @@ export const Group = <
259260
260261 const { chakraStyles } = selectProps ;
261262
262- const sx = chakraStyles ?. group ? chakraStyles . group ( { } , props ) : { } ;
263+ const initialSx : SystemStyleObject = { } ;
264+ const sx = chakraStyles ?. group
265+ ? chakraStyles . group ( initialSx , props )
266+ : initialSx ;
263267
264268 return (
265269 < Box { ...innerProps } className = { cx ( { group : true } , className ) } sx = { sx } >
@@ -288,11 +292,12 @@ export const GroupHeading = <
288292 const {
289293 cx,
290294 className,
291- children,
292295 // eslint-disable-next-line deprecation/deprecation
293296 selectProps : { chakraStyles, size : sizeProp , hasStickyGroupHeaders } ,
294297 } = props ;
295298
299+ const { data, ...innerProps } = cleanCommonProps ( props ) ;
300+
296301 const menuStyles = useMultiStyleConfig ( "Menu" ) ;
297302
298303 const size = useSize ( sizeProp ) ;
@@ -325,9 +330,11 @@ export const GroupHeading = <
325330 : initialSx ;
326331
327332 return (
328- < Box className = { cx ( { "group-heading" : true } , className ) } sx = { sx } >
329- { children }
330- </ Box >
333+ < Box
334+ { ...innerProps }
335+ className = { cx ( { "group-heading" : true } , className ) }
336+ sx = { sx }
337+ />
331338 ) ;
332339} ;
333340
@@ -371,20 +378,24 @@ export const Option = <
371378 } ,
372379 } = props ;
373380
374- const size = useSize ( sizeProp ) ;
375-
376381 const menuItemStyles : ThemeObject = useMultiStyleConfig ( "Menu" ) . item ;
377382
378- const paddings : SizeProps = {
379- sm : "0.3rem 0.6rem" ,
380- md : "0.4rem 0.8rem" ,
381- lg : "0.5rem 1rem" ,
383+ const size = useSize ( sizeProp ) ;
384+ const horizontalPaddingOptions : SizeProps = {
385+ sm : "0.6rem" ,
386+ md : "0.8rem" ,
387+ lg : "1rem" ,
388+ } ;
389+ const verticalPaddingOptions : SizeProps = {
390+ sm : "0.3rem" ,
391+ md : "0.4rem" ,
392+ lg : "0.5rem" ,
382393 } ;
383394
384395 /**
385- * Use the same selected color as the border of the select component
396+ * Use the same selected color as the border/shadow of the select/input components
386397 *
387- * @see {@link https://github.com/chakra-ui/chakra-ui/blob/13c6d2e08b61e179773be4722bb81173dd599306 /packages/theme/src/components/input.ts#L73 }
398+ * @see {@link https://github.com/chakra-ui/chakra-ui/blob/61f965a /packages/components/ theme/src/components/input.ts#L92-L93 }
388399 */
389400 const selectedBg = useColorModeValue (
390401 `${ selectedOptionColorScheme } .500` ,
@@ -394,39 +405,38 @@ export const Option = <
394405
395406 // Don't create exta space for the checkmark if using a multi select with
396407 // options that dissapear when they're selected
397- const showCheckIcon : boolean =
408+ const showCheckIcon =
398409 selectedOptionStyle === "check" &&
399410 ( ! isMulti || hideSelectedOptions === false ) ;
400411
401- const shouldHighlight : boolean =
402- selectedOptionStyle === "color" && isSelected ;
412+ const shouldHighlight = selectedOptionStyle === "color" ;
403413
404414 const initialSx : SystemStyleObject = {
405415 ...menuItemStyles ,
416+ cursor : "pointer" ,
406417 display : "flex" ,
407418 alignItems : "center" ,
408419 width : "100%" ,
409420 textAlign : "start" ,
410421 fontSize : size ,
411- padding : paddings [ size ] ,
412- ... ( isFocused && menuItemStyles . _focus ) ,
422+ paddingX : horizontalPaddingOptions [ size ] ,
423+ paddingY : verticalPaddingOptions [ size ] ,
413424 ...( shouldHighlight && {
414- bg : selectedBg ,
415- color : selectedColor ,
416- _active : { bg : selectedBg } ,
425+ _selected : {
426+ bg : selectedBg ,
427+ color : selectedColor ,
428+ _active : { bg : selectedBg } ,
429+ } ,
417430 } ) ,
418- ...( isDisabled && menuItemStyles . _disabled ) ,
419- ...( isDisabled && { _active : { } } ) ,
420431 } ;
421432
422433 const sx = chakraStyles ?. option
423434 ? chakraStyles . option ( initialSx , props )
424435 : initialSx ;
425-
426436 return (
427437 < Box
438+ role = "option"
428439 { ...innerProps }
429- role = "button"
430440 className = { cx (
431441 {
432442 option : true ,
@@ -438,8 +448,9 @@ export const Option = <
438448 ) }
439449 sx = { sx }
440450 ref = { innerRef }
441- data-disabled = { isDisabled ? true : undefined }
451+ data-focus = { isFocused ? true : undefined }
442452 aria-disabled = { isDisabled ? true : undefined }
453+ aria-selected = { isSelected }
443454 >
444455 { showCheckIcon && (
445456 < MenuIcon
0 commit comments