How to use the @reach/utils.getScrollbarOffset function in @reach/utils

To help you get started, we’ve selected a few @reach/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reach / reach-ui / packages / tooltip / examples / triangle.example.js View on Github external
const centered = (triggerRect, tooltipRect) => {
  const triggerCenter = triggerRect.left + triggerRect.width / 2;
  const left = triggerCenter - tooltipRect.width / 2;
  const maxLeft = window.innerWidth - tooltipRect.width - getScrollbarOffset();
  return {
    left: Math.min(Math.max(2, left), maxLeft) + window.scrollX,
    top: triggerRect.bottom + 8 + window.scrollY
  };
};

@reach/utils

Internal, shared utilities for Reach UI.

MIT
Latest version published 2 years ago

Package Health Score

82 / 100
Full package analysis

Similar packages