1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-09-03 06:12:53 +02:00

Fix focus issue on persona form

This commit is contained in:
Kamran Ahmed
2025-06-10 14:02:25 +01:00
parent cca2c1bd36
commit 7fa372141d

View File

@@ -168,20 +168,16 @@ export function RoadmapFloatingChat(props: RoadmapChatProps) {
// it means user came back to the AI chat from the topic detail // it means user came back to the AI chat from the topic detail
const handleCloseTopicDetail = () => { const handleCloseTopicDetail = () => {
lockBodyScroll(isOpen); lockBodyScroll(isOpen);
setTimeout(() => {
inputRef.current?.focus();
}, 0);
}; };
window.addEventListener(CLOSE_TOPIC_DETAIL_EVENT, handleCloseTopicDetail); window.addEventListener(CLOSE_TOPIC_DETAIL_EVENT, handleCloseTopicDetail);
return () => { return () => {
console.log('remove event listener');
window.removeEventListener( window.removeEventListener(
CLOSE_TOPIC_DETAIL_EVENT, CLOSE_TOPIC_DETAIL_EVENT,
handleCloseTopicDetail, handleCloseTopicDetail,
); );
}; };
}, [isOpen]); }, [isOpen, isPersonalizeOpen]);
function textToJSON(text: string): JSONContent { function textToJSON(text: string): JSONContent {
return { return {