Skip to content

Commit

Permalink
feat: add role prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Dang, Mai-Linh authored and gabrieljablonski committed Nov 21, 2023
1 parent 9e9ff0e commit e19d1b7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Tooltip/Tooltip.tsx
Expand Up @@ -61,6 +61,7 @@ const Tooltip = ({
border,
opacity,
arrowColor,
role = 'tooltip',
}: ITooltip) => {
const tooltipRef = useRef<HTMLElement>(null)
const tooltipArrowRef = useRef<HTMLElement>(null)
Expand Down Expand Up @@ -788,7 +789,7 @@ const Tooltip = ({
return rendered && !hidden && actualContent ? (
<WrapperElement
id={id}
role="tooltip"
role={role}
className={classNames(
'react-tooltip',
coreStyles['tooltip'],
Expand Down
1 change: 1 addition & 0 deletions src/components/Tooltip/TooltipTypes.d.ts
Expand Up @@ -153,4 +153,5 @@ export interface ITooltip {
border?: CSSProperties['border']
opacity?: CSSProperties['opacity']
arrowColor?: CSSProperties['backgroundColor']
role?: 'tooltip' | 'dialog'
}
2 changes: 2 additions & 0 deletions src/components/TooltipController/TooltipController.tsx
Expand Up @@ -59,6 +59,7 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
setIsOpen,
afterShow,
afterHide,
role,
}: ITooltipController,
ref,
) => {
Expand Down Expand Up @@ -356,6 +357,7 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
afterHide,
activeAnchor,
setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),
role,
}

return <Tooltip {...props} />
Expand Down
Expand Up @@ -93,6 +93,7 @@ export interface ITooltipController {
setIsOpen?: (value: boolean) => void
afterShow?: () => void
afterHide?: () => void
role?: 'tooltip' | 'dialog'
}

declare module 'react' {
Expand Down

0 comments on commit e19d1b7

Please sign in to comment.