Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add onblur event for Tooltip parent #1262

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

timwessman
Copy link
Contributor

@timwessman timwessman commented Apr 16, 2024

Description

Tooltip parent didn't have an on blur event. Now it has. JIRA HDS-2196

How Has This Been Tested?

Open Tooltip component in Storybooks -> click on (?) -button -> Tooltip comes visible -> press Tab -key -> Tooltip disappers

@timwessman timwessman requested a review from mrTuomoK April 16, 2024 09:58
Copy link
Contributor

@laurakarhu laurakarhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@timwessman timwessman merged commit 5bb4727 into development Apr 16, 2024
6 checks passed
@timwessman timwessman deleted the hds-2196-tooltip-onblur branch April 16, 2024 12:05
@@ -127,6 +127,7 @@ export const Tooltip = ({
aria-label={buttonLabel}
aria-expanded={isTooltipOpen}
onClick={onButtonClick}
onBlur={() => setIsTooltipOpen(false)}
Copy link
Contributor

@mrTuomoK mrTuomoK Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW is there a performance issue when using like this instead of using for example const onBlurHandler = () => {setToolTipOpen(false);} outside the render/return and calling it like onBlur={onBlurHandler}. If I remember correctly, React recreates the functions when rendering if declared like onBlur = {() => {}}. But you may prove me wrong :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, could be.

@laurakarhu laurakarhu added this to the HDS 3.8.0 milestone Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants