Skip to content

Commit

Permalink
fix: tabindex option
Browse files Browse the repository at this point in the history
  • Loading branch information
AtsushiM committed Apr 28, 2020
1 parent 3f46409 commit 1e54e00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/Tooltip/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ storiesOf('Tooltip', module).add('all', () => (
<dt>Default</dt>
<dd>
<LightTooltip message="LightBalloon">LightTooltip</LightTooltip>
</dd>
<dd>
<DarkTooltip message="DarkBalloon">DarkTooltip</DarkTooltip>
</dd>
<dt>horizontal & vertical</dt>
Expand Down
5 changes: 5 additions & 0 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Props = {
ellipsisOnly?: boolean
horizontal?: BalloonProps['horizontal']
vertical?: BalloonProps['vertical']
tabIndex?: number
}

const tooltipFactory: (balloonTheme: BalloonTheme) => FC<Props> = balloonTheme => ({
Expand All @@ -21,6 +22,7 @@ const tooltipFactory: (balloonTheme: BalloonTheme) => FC<Props> = balloonTheme =
ellipsisOnly = false,
horizontal = 'left',
vertical = 'bottom',
tabIndex = 0,
}) => {
const themes = useTheme()
const [isVisible, setIsVisible] = useState(false)
Expand Down Expand Up @@ -72,8 +74,11 @@ const tooltipFactory: (balloonTheme: BalloonTheme) => FC<Props> = balloonTheme =
ref={ref}
onMouseOver={overAction}
onTouchStart={overAction}
onFocus={overAction}
onMouseOut={outAction}
onTouchEnd={outAction}
onBlur={outAction}
tabIndex={tabIndex}
>
{isVisible && (
<StyledBalloon horizontal={horizontal} vertical={vertical} className={className}>
Expand Down

0 comments on commit 1e54e00

Please sign in to comment.