Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reset the eventKey to stop focusing on every new message user send/receive after opening a conversation using enter key #15814

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/script/components/MessagesList/Message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ const Message: React.FC<
}
if (history.state?.eventKey === 'Enter') {
handleFocus(totalMessage - 1);

// reset the eventKey to stop focusing on every new message user send/receive afterwards
// last message should be focused only when user enters a new conversation using keyboard(press enter)
history.state.eventKey = '';
window.history.replaceState(history.state, '', window.location.hash);
}
}, [totalMessage]);

Expand All @@ -160,7 +165,7 @@ const Message: React.FC<
if (isMessageFocused) {
messageRef.current?.focus();
}
}, [isMessageFocused, message]);
}, [isMessageFocused]);

// set message elements focus for non content type mesages
// some non content type message has interactive element like invite people for member message
Expand Down
Loading