@primer/react 0.0.0-20260501191321 → 0.0.0-20260501201044

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260501191321
3
+ ## 0.0.0-20260501201044
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -271,11 +271,21 @@ function getDefaultPosition(anchorElement, overlayElement, fallbackWidth) {
271
271
  const spaceRight = vw - anchorRect.right;
272
272
  const horizontal = spaceLeft > spaceRight ? 'left' : 'right';
273
273
 
274
- // Suggest flipping to the side of the anchor with more room when the
275
- // overlay is currently overflowing both axes.
274
+ // Suggest a flip when the overlay is currently overflowing both axes:
275
+ // prefer the side of the anchor with enough room, otherwise fall back to
276
+ // outside-bottom and let the offsets keep it inside the viewport.
276
277
  const overflowsX = overlayRect.right > vw || overlayRect.left < 0;
277
278
  const overflowsY = overlayRect.bottom > vh || overlayRect.top < 0;
278
- const suggestedSide = overflowsX && overflowsY ? spaceLeft > spaceRight ? 'outside-left' : 'outside-right' : undefined;
279
+ let suggestedSide;
280
+ if (overflowsX && overflowsY) {
281
+ if (spaceLeft >= overlayWidth + margin) {
282
+ suggestedSide = 'outside-left';
283
+ } else if (spaceRight >= overlayWidth + margin) {
284
+ suggestedSide = 'outside-right';
285
+ } else {
286
+ suggestedSide = 'outside-bottom';
287
+ }
288
+ }
279
289
 
280
290
  // If the viewport is too narrow to fit the overlay on either side, calculate offsets to prevent overflow.
281
291
  let leftOffset;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260501191321",
4
+ "version": "0.0.0-20260501201044",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",