Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: prevent editor from stealing focus in agent settings modal (#12512)

YuTengjing6c3e75634f5f
diff --git a/src/app/[variants]/(main)/agent/profile/index.tsx b/src/app/[variants]/(main)/agent/profile/index.tsx
index 6009cb2d739..b32685eb7aa 100644
--- a/src/app/[variants]/(main)/agent/profile/index.tsx
+++ b/src/app/[variants]/(main)/agent/profile/index.tsx
@@ -46,8 +46,12 @@ const ProfileArea = memo(() => {
height={'100%'}
style={styles.contentWrapper}
width={'100%'}
- onClick={() => {
- editor?.focus();
+ onClick={(e) => {
+ // Only focus editor for clicks within this DOM element,
+ // not from React portal (e.g. Modal) whose DOM is outside this tree
+ if (e.currentTarget.contains(e.target as Node)) {
+ editor?.focus();
+ }
}}
>
<WideScreenContainer>