@homebound/beam 3.12.0 → 3.12.1

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/dist/index.js CHANGED
@@ -4298,17 +4298,33 @@ function Popper(props) {
4298
4298
  styles,
4299
4299
  attributes
4300
4300
  } = usePopper(targetElement, popperRef.current, {
4301
- modifiers: [{
4302
- name: "arrow",
4303
- options: {
4304
- element: arrowRef
4305
- }
4306
- }, {
4307
- name: "offset",
4308
- options: {
4309
- offset: [0, 5]
4301
+ // Use `fixed` positioning so the portaled tooltip is positioned relative to the viewport.
4302
+ // With the default `absolute` strategy the tooltip is appended to `document.body` and counts
4303
+ // toward the document's scroll size, so a trigger near an edge pushes the tooltip past the
4304
+ // document bounds and introduces scrollbars / renders off-screen. `fixed` elements don't
4305
+ // contribute to document scroll size, so they can be kept within the viewport instead.
4306
+ strategy: "fixed",
4307
+ modifiers: [
4308
+ {
4309
+ name: "arrow",
4310
+ options: {
4311
+ element: arrowRef
4312
+ }
4313
+ },
4314
+ {
4315
+ name: "offset",
4316
+ options: {
4317
+ offset: [0, 5]
4318
+ }
4319
+ },
4320
+ // Keep the tooltip inside the viewport (with a small gutter) rather than overflowing it.
4321
+ {
4322
+ name: "preventOverflow",
4323
+ options: {
4324
+ padding: 8
4325
+ }
4310
4326
  }
4311
- }],
4327
+ ],
4312
4328
  placement
4313
4329
  });
4314
4330
  return createPortal(/* @__PURE__ */ jsxs("div", { ref: popperRef, ...attributes.popper, ...ariaProps, onMouseEnter, onMouseLeave, ...mergeProps_1(void 0, styles.popper, {