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

[popover2] fix(Popover2): close properly when target focus lost #5080

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

dlech
Copy link
Contributor

@dlech dlech commented Dec 21, 2021

The assumption that "a click handler somewhere else will close the popover if necessary" does not appear to be valid. If the user clicks on a non-focusable element. There are no other events that cause the popover to close other than mouseleave, but the mouse is not over the target when focus is lost.

Fixes #4503.

Fixes #0000

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

Reviewers should focus on:

Screenshot

The assumption that "a click handler somewhere else will close the popover if necessary" does not appear to be valid. If the user clicks on a non-focusable element. There are no other events that cause the popover to close other than mouseleave, but the mouse is not over the target when focus is lost.

Fixes palantir#4503.
@palantirtech
Copy link
Member

Thanks for your interest in palantir/blueprint, @dlech! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@adidahiya
Copy link
Contributor

Thanks for the PR, this does fix the bug. I can verify this in the docs preview:

2022-01-06 15 09 15

(press tab to focus & open, then click on document... the same interaction repros the bug on the current docs page)

It looks like this assumption about e.relatedTarget was first added to the Popover component in #3716, and then ported to Popover2. Your change in this PR doesn't seem to cause a regression, and it passes the test suite... should be good to go 👍🏽

@adidahiya adidahiya changed the title Fix tooltip not closing when focus lost [popover2] fix(Popover2): close properly when target focus lost Jan 6, 2022
@adidahiya adidahiya merged commit 8e4fd63 into palantir:develop Jan 6, 2022
@dlech dlech deleted the patch-1 branch January 6, 2022 20:20
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.

Tooltip does not close if focus is triggered by keyboard but removed mouse
3 participants