Skip to content

Commit cd33134

Browse files
committed
fix(App): avoid autofocusing embeds
1 parent d5f727c commit cd33134

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/livecodes/UI/modal.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { createAccordion } from './accordion';
55

66
export const createModal = (deps: {
77
translate: (container: HTMLElement) => void;
8+
isEmbed: boolean;
89
onClose: () => void;
910
}): Modal => {
1011
const overlay = document.querySelector('#overlay') as HTMLElement;
@@ -21,7 +22,7 @@ export const createModal = (deps: {
2122
isAsync = false,
2223
onClose = () => undefined,
2324
scrollToSelector = '',
24-
autoFocus = true,
25+
autoFocus = !deps.isEmbed,
2526
}: ModalOptions = {},
2627
) => {
2728
modal.className = size;

src/livecodes/core.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5003,7 +5003,15 @@ const changeAppLanguage = async (appLanguage: AppLanguage) => {
50035003

50045004
const basicHandlers = () => {
50055005
notifications = createNotifications();
5006-
modal = createModal({ translate: translateElement, onClose: () => getActiveEditor().focus() });
5006+
modal = createModal({
5007+
translate: translateElement,
5008+
isEmbed,
5009+
onClose: () => {
5010+
if (!isEmbed) {
5011+
getActiveEditor().focus();
5012+
}
5013+
},
5014+
});
50075015
split = createSplitPanes();
50085016
typeLoader = createTypeLoader(baseUrl);
50095017

0 commit comments

Comments
 (0)