Skip to content

Commit 531da73

Browse files
vkalapsazovadxcity
authored andcommitted
Pull request #6053: [DXCF-5832] [The5ers][Web] Modal size of the settings menu remains full screen after resizing the browser back to desktop size.
Merge in DXCHARTS/dxchart5 from bugfix/DXCF-5832-resizing-settings-modal-issue to master Squashed commit of the following: commit e3be54f60e03f0627d735a9be6a1859ad85a71c6 Author: Vanina Kalapsazova <[email protected]> Date: Fri Oct 24 14:37:55 2025 +0300 [DXCF-5832] [The5ers][Web] Modal size of the settings menu remains full screen after resizing the browser back to desktop size. // add mobile and ua cache and change vp unit commit 2330e41475f2d82168d21e8faa44c913e033ea3e Author: Vanina Kalapsazova <[email protected]> Date: Thu Oct 23 13:46:14 2025 +0300 [DXCF-5832] [The5ers][Web] Modal size of the settings menu remains full screen after resizing the browser back to desktop size. // update the popup position calculation when switching desktop to mobile and reverse commit 30dddb9b6c9b821418eb082bfb476dea471b5eff Author: Vanina Kalapsazova <[email protected]> Date: Tue Oct 21 10:54:42 2025 +0300 [DXCF-5832] [The5ers][Web] Modal size of the settings menu remains full screen after resizing the browser back to desktop size. // update useMobile custom hook to improve layout mode detection GitOrigin-RevId: 3b7e819bf4f5e43a72be8338a52c075895b3ef23
1 parent 08dc67d commit 531da73

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/chart/utils/device/browser.utils.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
44
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
6-
let isMobileCache: boolean | undefined = undefined;
6+
let isMobileCache: boolean | undefined;
7+
let userAgentCache: string | undefined;
78
/**
89
* @doc-tags utility,mobile
910
*/
1011
export const isMobile = () => {
11-
if (!isMobileCache) {
12-
isMobileCache = !!navigator.userAgent.match(/Android|iPhone|Opera Mini/) || false;
12+
if (typeof navigator === 'undefined') {
13+
return false;
14+
}
15+
16+
const currentUserAgent = navigator.userAgent;
17+
if (userAgentCache !== currentUserAgent || isMobileCache === undefined) {
18+
userAgentCache = currentUserAgent;
19+
isMobileCache = !!currentUserAgent.match(/Android|iPhone|Opera Mini/);
1320
}
1421
return isMobileCache;
1522
};

0 commit comments

Comments
 (0)