File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
packages/react-core/src/components Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export interface DividerProps extends React.HTMLProps<HTMLElement> {
3232 '2xl' ?: 'vertical' | 'horizontal' ;
3333 } ;
3434 /** The ARIA role of the divider when the component property has a value other than "hr". */
35- role ?: string ;
35+ role ?: 'separator' | 'presentation' ;
3636}
3737
3838export const Divider : React . FunctionComponent < DividerProps > = ( {
Original file line number Diff line number Diff line change @@ -185,12 +185,19 @@ export const ToolbarItem: React.FunctionComponent<ToolbarItemProps> = ({
185185 children,
186186 isAllExpanded,
187187 isOverflowContainer,
188+ role,
188189 ...props
189190} : ToolbarItemProps ) => {
190191 if ( variant === ToolbarItemVariant . separator ) {
191- // TODO: consider removing spread props here so we can update Divider role prop to union of
192- // separator or presentation rather than generic string
193- return < Divider className = { css ( className ) } orientation = { { default : 'vertical' } } { ...props } /> ;
192+ const isDividerRoleValid = role === 'separator' || role === 'presentation' ;
193+ return (
194+ < Divider
195+ className = { css ( className ) }
196+ orientation = { { default : 'vertical' } }
197+ { ...props }
198+ { ...( isDividerRoleValid && { role : role as 'separator' | 'presentation' } ) }
199+ />
200+ ) ;
194201 }
195202
196203 return (
@@ -219,6 +226,7 @@ export const ToolbarItem: React.FunctionComponent<ToolbarItemProps> = ({
219226 ) }
220227 { ...( variant === 'label' && { 'aria-hidden' : true } ) }
221228 id = { id }
229+ role = { role }
222230 { ...props }
223231 >
224232 { children }
You can’t perform that action at this time.
0 commit comments