Skip to content

Commit e19d1b7

Browse files
dmbln34gabrieljablonski
authored andcommitted
feat: add role prop
1 parent 9e9ff0e commit e19d1b7

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/components/Tooltip/Tooltip.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const Tooltip = ({
6161
border,
6262
opacity,
6363
arrowColor,
64+
role = 'tooltip',
6465
}: ITooltip) => {
6566
const tooltipRef = useRef<HTMLElement>(null)
6667
const tooltipArrowRef = useRef<HTMLElement>(null)
@@ -788,7 +789,7 @@ const Tooltip = ({
788789
return rendered && !hidden && actualContent ? (
789790
<WrapperElement
790791
id={id}
791-
role="tooltip"
792+
role={role}
792793
className={classNames(
793794
'react-tooltip',
794795
coreStyles['tooltip'],

src/components/Tooltip/TooltipTypes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,5 @@ export interface ITooltip {
153153
border?: CSSProperties['border']
154154
opacity?: CSSProperties['opacity']
155155
arrowColor?: CSSProperties['backgroundColor']
156+
role?: 'tooltip' | 'dialog'
156157
}

src/components/TooltipController/TooltipController.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
5959
setIsOpen,
6060
afterShow,
6161
afterHide,
62+
role,
6263
}: ITooltipController,
6364
ref,
6465
) => {
@@ -356,6 +357,7 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
356357
afterHide,
357358
activeAnchor,
358359
setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),
360+
role,
359361
}
360362

361363
return <Tooltip {...props} />

src/components/TooltipController/TooltipControllerTypes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export interface ITooltipController {
9393
setIsOpen?: (value: boolean) => void
9494
afterShow?: () => void
9595
afterHide?: () => void
96+
role?: 'tooltip' | 'dialog'
9697
}
9798

9899
declare module 'react' {

0 commit comments

Comments
 (0)