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

Fix #4027 #5208

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Fix #4027 #5208

wants to merge 6 commits into from

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented Nov 1, 2024

Goal: Once SelectPanel opens upwards, do not resize it anymore.

Closes #

Changelog

New

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copy link

changeset-bot bot commented Nov 1, 2024

⚠️ No Changeset found

Latest commit: b316bb1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@siddharthkp siddharthkp self-assigned this Nov 1, 2024
@github-actions github-actions bot added the staff Author is a staff member label Nov 1, 2024
Copy link
Contributor

github-actions bot commented Nov 1, 2024

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

Copy link
Contributor

github-actions bot commented Nov 1, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 98.59 KB (+0.11% 🔺)
packages/react/dist/browser.umd.js 98.85 KB (-0.03% 🔽)

@@ -31,5 +32,5 @@ export function useResizeObserver<T extends HTMLElement>(callback: ResizeObserve
return () => {
observer.disconnect()
}
}, [target])
}, [targetEl])
Copy link
Member Author

Choose a reason for hiding this comment

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

Note for reviewer: Adding a ref as dependency isn't a recommended pattern as changes to the value of the ref does not cause the effect to re-run. Replaced the ref with targetEl instead

@@ -107,7 +107,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr
overlayProps,
focusTrapSettings,
focusZoneSettings,
side = 'outside-bottom',
side = overlayProps?.['anchorSide'] || 'outside-bottom',
Copy link
Member Author

Choose a reason for hiding this comment

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

Let's not do this just yet. Pull this out to another PR of it's own

@@ -45,7 +45,8 @@ export function useAnchoredPosition(

useLayoutEffect(updatePosition, [updatePosition])

useResizeObserver(updatePosition)
useResizeObserver(updatePosition) // watches for changes in window size
useResizeObserver(updatePosition, floatingElementRef as React.RefObject<HTMLElement>) // watches for changes in floating element size
Copy link
Member Author

Choose a reason for hiding this comment

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

Note for self: This needs to be opt-in. A bit risky to always do this because it would keep jumping around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant