Skip to content

Keep message field focused after starting chat#2399

Closed
mysubcult wants to merge 1 commit into
LiveHelperChat:masterfrom
mysubcult:widget-preserve-focus-after-start
Closed

Keep message field focused after starting chat#2399
mysubcult wants to merge 1 commit into
LiveHelperChat:masterfrom
mysubcult:widget-preserve-focus-after-start

Conversation

@mysubcult

Copy link
Copy Markdown
Contributor

This improves the first-message UX in the React widget.

Before this change, starting a chat can visually look like the message textarea loses focus while the widget transitions from StartChat to OnlineChat. StartChat already focuses #CSChatMessage before submitting, but the component switch can still briefly interrupt the focused input.

The change stores a short-lived flag when the start-chat message field was focused and restores focus once OnlineChat has mounted, using the same widget/popup visibility condition that already guards the existing focus logic.

Tested with:

  • npm ci
  • npm run build

@mysubcult mysubcult force-pushed the widget-preserve-focus-after-start branch from 481df47 to 05e13be Compare July 4, 2026 14:04
@mysubcult mysubcult force-pushed the widget-preserve-focus-after-start branch from 05e13be to b12ce79 Compare July 4, 2026 14:10
@remdex

remdex commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Record video what presently does not work you there?

https://livehelperchat.com

What happens if chat is started by clicking button? Start chat can do not have send message area and in temporary status you still focusing area...

@mysubcult

Copy link
Copy Markdown
Contributor Author

Record video what presently does not work you there?

https://livehelperchat.com

What happens if chat is started by clicking button? Start chat can do not have send message area and in temporary status you still focusing area...

firefox_f1LZzQfkpS.mp4

Hello! I have recorded a video to demonstrate the issue, as you requested.

The reason it might be difficult to notice the problem on the official demo site (livehelperchat.com) is that the default theme lacks a clear visual highlight for the active/focused input field—it only shows a blinking cursor.

To make the issue clearly visible, I demonstrated it on my own website where I use a custom theme. In my theme, the active input field is distinctly highlighted with a red border when it is in focus.

As you can see in the attached video:

I type a message (e.g., "hi") while the input field is focused (the red border is visible).

Immediately after sending the message, the red border briefly disappears and then reappears.

This momentary "blink" indicates that the input field loses focus and then regains it right after submission (focus -> unfocus -> focus).

This brief loss of focus is exactly the problem I am referring to. I hope the video helps clarify this!

@remdex

remdex commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

And i don't have this issue adding. Green border remains all long way untill chat starts. You could easily replace it on official demo.

#CSChatMessage:focus{
    border:1px solid green!important;
}```

@mysubcult

Copy link
Copy Markdown
Contributor Author

Closing this PR because the maintainer could not reproduce the focus loss in the default widget and pointed out that the visible focus state should be handled at theme/CSS level. I have reverted the React/widget changes on my production instance and moved the visible focus styling to my local theme CSS instead. Thanks for checking it.

@mysubcult mysubcult closed this Jul 6, 2026
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

Successfully merging this pull request may close these issues.

2 participants