mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-21 04:58:45 -05:00
fix: handle window property access in sandboxed environments
Wraps window.self === window.top check in try-catch to prevent TypeError in Instagram iOS WebView where window.webkit.messageHandlers is undefined. Defaults to false if error occurs. Fixes FORMBRICKS-PP
This commit is contained in:
@@ -169,7 +169,13 @@ export function Survey({
|
||||
);
|
||||
}, [survey.variables]);
|
||||
|
||||
const autoFocusEnabled = autoFocus ?? window.self === window.top;
|
||||
const autoFocusEnabled = (() => {
|
||||
try {
|
||||
return autoFocus ?? window.self === window.top;
|
||||
} catch {
|
||||
return autoFocus ?? false;
|
||||
}
|
||||
})();
|
||||
|
||||
// Block-based navigation: track current block ID instead of question ID
|
||||
const [blockId, setBlockId] = useState(() => {
|
||||
|
||||
Reference in New Issue
Block a user