Skip to content

Commit

Permalink
fix: use 1px check for layout rect (floating-ui#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks authored Mar 2, 2021
1 parent cd4c19d commit 2422a68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dom-utils/getLayoutRect.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export default function getLayoutRect(element: HTMLElement): Rect {
let width = element.offsetWidth;
let height = element.offsetHeight;

if (Math.abs(clientRect.width - width) <= 0.5) {
if (Math.abs(clientRect.width - width) <= 1) {
width = clientRect.width;
}

if (Math.abs(clientRect.height - height) <= 0.5) {
if (Math.abs(clientRect.height - height) <= 1) {
height = clientRect.height;
}

Expand Down

0 comments on commit 2422a68

Please sign in to comment.