File tree Expand file tree Collapse file tree
packages/react-aria-components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -394,14 +394,15 @@ export const TabPanels = /*#__PURE__*/ createHideableComponent(function TabPanel
394394 prevSize . current = ref . current . getBoundingClientRect ( ) ;
395395 }
396396
397- let DOMProps = filterDOMProps ( props , { global : true } ) ;
397+ let DOMProps = filterDOMProps ( props , { labelable : true , global : true } ) ;
398398 delete DOMProps . id ;
399399
400400 return (
401401 < dom . div
402402 render = { props . render }
403403 { ...DOMProps }
404404 ref = { ref }
405+ style = { props . style }
405406 className = { props . className || 'react-aria-TabPanels' } >
406407 < Collection { ...props } />
407408 </ dom . div >
Original file line number Diff line number Diff line change @@ -649,6 +649,42 @@ describe('Tabs', () => {
649649 expect ( tabs [ 2 ] ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
650650 } ) ;
651651
652+ it ( 'should support tabpanels with aria-labels' , ( ) => {
653+ let { getByTestId} = render (
654+ < Tabs >
655+ < TabList aria-label = "test" >
656+ < Tab id = "a" > A</ Tab >
657+ < Tab id = "b" > B</ Tab >
658+ </ TabList >
659+ < TabPanels aria-label = "test" data-testid = "tabpanels" >
660+ < TabPanel id = "a" > A</ TabPanel >
661+ < TabPanel id = "b" > B</ TabPanel >
662+ </ TabPanels >
663+ </ Tabs >
664+ ) ;
665+
666+ let tabPanels = getByTestId ( 'tabpanels' ) ;
667+ expect ( tabPanels ) . toHaveAttribute ( 'aria-label' , 'test' ) ;
668+ } ) ;
669+
670+ it ( 'should support tabpanels with custom styles' , ( ) => {
671+ let { getByTestId} = render (
672+ < Tabs >
673+ < TabList aria-label = "test" >
674+ < Tab id = "a" > A</ Tab >
675+ < Tab id = "b" > B</ Tab >
676+ </ TabList >
677+ < TabPanels style = { { width : '100px' } } data-testid = "tabpanels" >
678+ < TabPanel id = "a" > A</ TabPanel >
679+ < TabPanel id = "b" > B</ TabPanel >
680+ </ TabPanels >
681+ </ Tabs >
682+ ) ;
683+
684+ let tabPanels = getByTestId ( 'tabpanels' ) ;
685+ expect ( tabPanels ) . toHaveStyle ( { width : '100px' } ) ;
686+ } ) ;
687+
652688 it ( 'supports tooltips' , async function ( ) {
653689 let { getByRole, getAllByRole} = render (
654690 < Tabs >
You can’t perform that action at this time.
0 commit comments