Skip to content

Conversation

@HichamELBSI
Copy link
Collaborator

Fix popover repositioning. Useful for the Combobox component.

Before After
before after

Signed-off-by: HichamELBSI <elabbassih@gmail.com>
@vercel
Copy link

vercel bot commented Feb 15, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

design-system – ./

🔍 Inspect: https://vercel.com/strapijs/design-system/5cGSP7kykBdeqsTSiQnVUCZxogc1
✅ Preview: https://design-system-git-fix-popover-position-strapijs.vercel.app

design-system-website – ./website

🔍 Inspect: https://vercel.com/strapijs/design-system-website/TCLxrP7436S9LzQAeaJrAGevNNaw
✅ Preview: https://design-system-website-git-fix-popover-position-strapijs.vercel.app

);

useResizeObserver(source, () =>
useResizeObserver([source, popoverRef], () =>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ℹ️ Add the popover as a source to observe in order to trigger the setPosition on every changes on this element.

useEffect(() => {
const resizeObs = new ResizeObserver(onResize);
resizeObs.observe(source.current);
if (Array.isArray(sources)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ℹ️ Be able to observe multiple sources

Copy link
Contributor

Choose a reason for hiding this comment

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

that's so nice, thank you!

Copy link
Contributor

@ronronscelestes ronronscelestes left a comment

Choose a reason for hiding this comment

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

YAY well done 🔥🙏

Copy link
Contributor

@gu-stav gu-stav left a comment

Choose a reason for hiding this comment

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

So cool ✨

@HichamELBSI HichamELBSI changed the base branch from main to 1.0.0 February 15, 2022 16:03
@HichamELBSI HichamELBSI merged commit 5bd60ab into 1.0.0 Feb 15, 2022
@HichamELBSI HichamELBSI deleted the fix/popover-position branch February 15, 2022 17:18
@HichamELBSI HichamELBSI added this to the 1.0.0 milestone Feb 22, 2022
@HichamELBSI HichamELBSI added the pr: fix This PR is fixing a bug label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fix This PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants