Skip to content

Commit

Permalink
fix(dom-helper): element null check
Browse files Browse the repository at this point in the history
  • Loading branch information
mukuljainx committed May 19, 2021
1 parent 61ed8ba commit 0d0ef7d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils/dom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const isInside = (
element: HTMLElement,
coordinate: { left: number; right?: number; top: number; bottom?: number }
) => {
if (!element) return false;
const { left, right, bottom, top } = element.getBoundingClientRect();
// if bottom and right not exist then it's a point
if (!coordinate.right || !coordinate.bottom) {
Expand Down Expand Up @@ -30,6 +31,7 @@ export const getOverflowAdjust = (
element: HTMLElement,
coordinate: { left: number; right: number; top: number; bottom: number }
) => {
if (!element) return { left: 0, top: 0 };
const { left, right, bottom, top } = element.getBoundingClientRect();

let horizontallyAdjustable = true;
Expand Down

0 comments on commit 0d0ef7d

Please sign in to comment.