From 1b65f878c59f8052c871cf1361eaf9b2637ec52a Mon Sep 17 00:00:00 2001 From: Maxime Date: Wed, 29 Sep 2021 14:15:31 -0400 Subject: [PATCH] refactor(DeviceContextProvider): revert to innerWidth --- .../device-context-provider/device-context-provider.test.tsx | 2 +- .../device-context-provider/device-context-provider.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/device-context-provider/device-context-provider.test.tsx b/packages/react/src/components/device-context-provider/device-context-provider.test.tsx index b91e759af3..676d28f4b1 100644 --- a/packages/react/src/components/device-context-provider/device-context-provider.test.tsx +++ b/packages/react/src/components/device-context-provider/device-context-provider.test.tsx @@ -32,7 +32,7 @@ function getContextObject( } function setScreenWidth(width: number): void { - Object.defineProperty(window, 'outerWidth', { writable: true, configurable: true, value: width }); + Object.defineProperty(window, 'innerWidth', { writable: true, configurable: true, value: width }); } describe('Device Context Provider', () => { diff --git a/packages/react/src/components/device-context-provider/device-context-provider.tsx b/packages/react/src/components/device-context-provider/device-context-provider.tsx index efd7087d94..71da2e5caa 100644 --- a/packages/react/src/components/device-context-provider/device-context-provider.tsx +++ b/packages/react/src/components/device-context-provider/device-context-provider.tsx @@ -69,7 +69,7 @@ export const DeviceContextProvider: FunctionComponent(getDeviceContext(staticDevice)); function handleScreenResize(): void { - const screenWidth = (window.outerWidth || document.documentElement.clientWidth); + const screenWidth = (window.innerWidth || document.documentElement.clientWidth); const currentDevice = getDevice(screenWidth); setDevice(getDeviceContext(currentDevice));