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.

Dropdown scroll within a popover closes popover

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Scrolling dropdown with the scrollbar inside a popover closes the popover. Scrolling with a wheel/trackpad works.

const App = () => {
  const [visible, setVisible] = useState(false);

  const handleVisibleChange = (visible) => {
    setVisible(visible);
  };

  return (
    <Popover
      content={
        <div>
          <Select style={{ width: 300 }}>
            {new Array(30).fill({}).map((_, i) => (
              <Select.Option key={i}>{i}</Select.Option>
            ))}
          </Select>
        </div>
      }
      title="Title"
      trigger="click"
      visible={visible}
      onVisibleChange={handleVisibleChange}
    >
      <Button type="primary">Click me</Button>
    </Popover>
  );
};

https://user-images.githubusercontent.com/51488/114467391-b6444e80-9b9e-11eb-9014-0281e50cfc93.mp4

What is expected?

To have both popover and dropdown stay open.

What is actually happening?

Popoever closes and then the dropdown closes.

Environment Info
antd 4.15.1
React 16.14.0
System OS X
Browser Chrome 89

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
eladocommented, Apr 13, 2021

@afc163

This is an old bug that has been fixed since v3.11.x. If you’re using an older version, you can use <Select getPopupContainer={trigger => trigger.parentElement}> to render a component inside Popover. (Or other getXxxxContainer props)

Thanks. Looks like this bug still exists in 4.15.1 (see codesandbox link). The getPopupContainer works though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap 4: Why popover inside scrollable dropdown doesn't ...
I need overflow:hidden; to make the dropdown scroll, but the popover is hidden too. I tried to use container:'body' but it didn't work....
Read more >
Popover Usage - ServiceNow Developers
The popover maintains its position relative to the triggering element when the triggering element is scrolled out of view. When the content exceeds...
Read more >
Popover - Carbon Design System
Scrolling is usually not needed when using a popover. If scrolling is needed, in a dropdown like situation for instance, then the body...
Read more >
Popover issue in filemaker go - Claris Community
4) Click anywhere on the popover. The popover closes like if I had clicked outside it. If there's a button behind it, it...
Read more >
How to prevent popup close on scroll in Kendo UI for jQuery
And press 'Edit this example'. In dojo You will see the 'bug'. If You choose library Q2 or Q2 SP1, You can't scroll...
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