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

Focus on beginning of message #774

Open
longhornrumble opened this issue Jan 23, 2025 · 2 comments
Open

Focus on beginning of message #774

longhornrumble opened this issue Jan 23, 2025 · 2 comments

Comments

@longhornrumble
Copy link

When my bot provides an answer or provides a set of response cards, the message list shows the end of the last communication causing the user to have to scroll back up to read the beginning of the response. How do I get the focus to stick on the beginning of the response instead of the end of it?

I'm getting this:

Image

When I want this:

Image

@atjohns
Copy link
Contributor

atjohns commented Jan 23, 2025

We don't have a way to do this as part of the native web ui, I can see if I can figure out a way to do it with a customization however.

@longhornrumble
Copy link
Author

Thanks, @atjohns.

I wonder if I could add some auto-scrolling Java script to the file that controls the messaging display. Something like:

// Add this function to handle auto-scrolling
const scrollToTop = () => {
const chatContainer = document.querySelector('.lex-web-ui-chat-container');
if (chatContainer) {
const lastMessage = chatContainer.querySelector('.lex-web-ui-message:last-child');
if (lastMessage) {
lastMessage.scrollIntoView({ behavior: 'smooth', block: 'start' }); // Scrolls to the top of the new message
}
}
};

// Call the scrollToTop function whenever a new message is added
const handleNewMessage = (message) => {
// Existing logic for adding messages to the DOM
renderMessage(message);

// Scroll to the top of the new message
scrollToTop();
};

If you think this is feasible, which file(s) would need to be manipulated?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants