diff --git a/packages/@react-aria/dnd/test/useDroppableCollection.test.js b/packages/@react-aria/dnd/test/useDroppableCollection.test.js index 672c415bced..9eded156702 100644 --- a/packages/@react-aria/dnd/test/useDroppableCollection.test.js +++ b/packages/@react-aria/dnd/test/useDroppableCollection.test.js @@ -56,7 +56,7 @@ describe('useDroppableCollection', () => { return this.getBoundingClientRect().top; }); - jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(function () { + jest.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockImplementation(function () { return this.getBoundingClientRect().height; }); diff --git a/packages/@react-aria/selection/src/DOMLayoutDelegate.ts b/packages/@react-aria/selection/src/DOMLayoutDelegate.ts index 8b427d3fa01..fe54211a910 100644 --- a/packages/@react-aria/selection/src/DOMLayoutDelegate.ts +++ b/packages/@react-aria/selection/src/DOMLayoutDelegate.ts @@ -34,8 +34,8 @@ export class DOMLayoutDelegate implements LayoutDelegate { let itemRect = item.getBoundingClientRect(); return { - x: itemRect.left - containerRect.left + container.scrollLeft, - y: itemRect.top - containerRect.top + container.scrollTop, + x: itemRect.left - containerRect.left - container.clientLeft + container.scrollLeft, + y: itemRect.top - containerRect.top - container.clientTop + container.scrollTop, width: itemRect.width, height: itemRect.height }; @@ -54,8 +54,8 @@ export class DOMLayoutDelegate implements LayoutDelegate { return { x: container?.scrollLeft ?? 0, y: container?.scrollTop ?? 0, - width: container?.offsetWidth ?? 0, - height: container?.offsetHeight ?? 0 + width: container?.clientWidth ?? 0, + height: container?.clientHeight ?? 0 }; } } diff --git a/packages/react-aria-components/test/Table.test.js b/packages/react-aria-components/test/Table.test.js index 667096ceabd..b003525254e 100644 --- a/packages/react-aria-components/test/Table.test.js +++ b/packages/react-aria-components/test/Table.test.js @@ -1633,7 +1633,7 @@ describe('Table', () => { }); describe('load more spinner', () => { - let offsetHeight, scrollHeight; + let clientHeight, scrollHeight; let DndTable = stories.DndTable; let initialItems = [ {id: '1', type: 'file', name: 'Adobe Photoshop'}, @@ -1641,7 +1641,7 @@ describe('Table', () => { ]; beforeAll(function () { scrollHeight = jest.spyOn(window.HTMLElement.prototype, 'scrollHeight', 'get').mockImplementation(() => 200); - offsetHeight = jest.spyOn(window.HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(function () { + clientHeight = jest.spyOn(window.HTMLElement.prototype, 'clientHeight', 'get').mockImplementation(function () { if (this.getAttribute('role') === 'grid') { return 200; } @@ -1651,7 +1651,7 @@ describe('Table', () => { }); afterAll(function () { - offsetHeight.mockReset(); + clientHeight.mockReset(); scrollHeight.mockReset(); });