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(AnchoredOverlay): allow overlay to reflow #5210

Merged

Conversation

francinelucca
Copy link
Member

@francinelucca francinelucca commented Nov 1, 2024

Closes https://github.com/github/primer/issues/3420

Adds support for the changes introduced in #5129 for AnchoredOverlay to allow overlay to reflow on small viewport sizes. Also modifies Overlay's reflow logic to always allow the overlay to reflow when the content of the overlay exceeds the size of the viewport, independently of which width is used. This guarantees accessibility in terms of WCAG 2.2 Success Criterion 1.4.10 Reflow (Level AA)

Changelog

New

  • Adds new preventOverflow prop to AnchoredOverlay's *.docs.json file
  • Ports over Overlay's preventOverflow prop to AnchoredOverlay

Changed

  • Do not take width into consideration for Overlay's reflow (reflow at all sizes if enabled)
  • Update js Docs to account for new reflow behavior
  • Adds preventOverflow={false} to AnchoredOverlay's stories to allow reflow
  • Modify AnchoredOverlay's stories that use hoverCard to set the min-width on the overlay instead of the hoverCard container (this helps with reflow)

Removed

  • Removes outdated reflow-width test

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

Go to playground and width AnchoredOverlay stories and resize the browser, notice the reflow on small viewports. Compare to production.

Merge checklist

Copy link

changeset-bot bot commented Nov 1, 2024

🦋 Changeset detected

Latest commit: 6202c7b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

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

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!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 1, 2024
Copy link
Contributor

github-actions bot commented Nov 1, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 98.53 KB (+0.03% 🔺)
packages/react/dist/browser.umd.js 98.87 KB (-0.04% 🔽)

@primer-integration
Copy link

primer-integration bot commented Nov 1, 2024

🟢 golden-jobs completed with status success.

@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/349748

@francinelucca francinelucca added status: review needed integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed status: wip integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Nov 5, 2024
@@ -112,6 +117,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr
alignmentOffset,
anchorOffset,
className,
preventOverflow = true,
Copy link
Member Author

Choose a reason for hiding this comment

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

On by default, which means the overlay will NOT reflow unless preventOverflow={false} is explicitly set as a prop on the component. This is of course overriden by the primer_react_overlay_overflow FF introduced in https://github.com/primer/react/pull/5129/files#diff-228ff69d3a08b1a41b50995af899947232eb64943d74ffd7aefd6bdd80aac449R9

@francinelucca francinelucca marked this pull request as ready for review November 5, 2024 21:53
@francinelucca francinelucca requested a review from a team as a code owner November 5, 2024 21:53
Copy link
Contributor

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@francinelucca francinelucca added this pull request to the merge queue Nov 7, 2024
Merged via the queue into main with commit b1950f5 Nov 7, 2024
50 of 51 checks passed
@francinelucca francinelucca deleted the 3420-prcanchoredoverlay-example-overlay-has-fixed-width branch November 7, 2024 20:17
@primer primer bot mentioned this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AnchoredOverlay integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh staff Author is a staff member status: review needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants