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

feat(tooltip/popover/dropdown): add custom container support #4551

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

steve3d
Copy link
Contributor

@steve3d steve3d commented Aug 9, 2023

Before submitting a pull request, please make sure you have at least performed the following:

  • read and followed the CONTRIBUTING.md and DEVELOPER.md guide.
  • built and tested the changes locally.
  • added/updated any applicable tests.
  • added/updated any applicable API documentation.
  • added/updated any applicable demos.

Currently in ng-bootstrap, there is no way of setting the container of tooltip/popover/dropdown to other values, the only accepted values are null and body, which is not enough. For example, I have something like

<body>
  <app-root>
      <div id="screen"></div>
  </app-root>
</body>

or somthing like above, then if I need to make #screen div fullscreen, then all tooltip/popover/dropdown with container=body will not work, without the container=body the actual container must not be overflow: hidden, this is huge restriction. And my special case has much more problem, I have a something in table, the outer component also need to be fullscreen, in the cells of this table, I have dropdown as actions menu, have tooltip on some elements, and also the popover on some elements, without this custom container support, my use case will only work without the component fullscreen.

So I've changed the container input, which accept an valid css selector or a HTMLElement, then tooltip/popover/dropdown will use this container element as the real container. this will solve the many problems.

and I don't think there will be any new test, because the body string value in container is a valid CSS selector. so the old tests works fine.

And I believe this will also fix #1884 and #870 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use any selector for popover container
2 participants