question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Popover doesn't close when clicking a button that would cause a a modal to be rendered

See original GitHub issue

Describe the issue. What is the expected and unexpected behavior? In OCM we have some help popovers in cards where there’s also a button that opens a modal by rendering a new one (it’s not rendered at all when closed). If a popover is opened, and this button is clicked - the popover remains open. I expect the popover to close, just like it closes when I click anywhere else in the page.

Please provide the steps to reproduce. Feel free to link CodeSandbox or another tool. https://codesandbox.io/s/boring-clarke-jw9nb?file=/index.js

Is this a bug or enhancement? If this issue is a bug, is this issue blocking you or is there a work-around? bug

What is your product and what release version are you targeting? OCM. We’re currently on "@patternfly/react-core": "^4.63.3", but this bug reproduces with the latest version as well (see reproducer link above)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jschulercommented, Dec 2, 2020

Thanks for reporting @elad661 , I’ll take a look at this. In the meantime for an easy workaround:

<Button
          variant="secondary"
          onClick={() => {
            setTimeout(() => {
              this.setState({ isOpen: true });
            }, 0);
          }}
        >
          Button
        </Button>
0reactions
nicolethoencommented, Sep 23, 2022

@kmcfaul provided the solution to this issue, thanks Katie!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Dismiss a React-Bootstrap Popover on Click Outside
Another method to dismiss the popover is by using a different trigger event. You can use the hover or focus trigger instead of...
Read more >
close popover manually · Issue #427 · tailwindlabs/headlessui
One workaround would be to manually click the Popover.Button through ref (have to assume that popover is open), eg in React: const buttonRef ......
Read more >
ReactBootstrap popover dismiss on click outside
@knowbody that gets really close but click and focus, means it immediately closes when you click it the first time (see jsfiddle.net/862fht00), ...
Read more >
Popovers · Bootstrap v5.0
When a keyboard user opens a popover, focus remains on the triggering element, and as the popover usually does not immediately follow the...
Read more >
Popover - Chakra UI
In this case, you can only open and close the popover with Button . If you click on Input , it acts same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found