Chat & keyboard focus
Use case: pressing a key opens a React chat input that should immediately accept typing.
The supported pattern
Put the chat browser in your HUD widget at design time and toggle it, rather than creating and destroying it around each conversation.
- Open chat: BP switches to
UIOnly(orGameAndUI) input mode and shows the chat browser. - Close chat: pressing Esc or submitting (Enter) — the React side sends a
chat:closedevent back; BP hides it and returns input mode toGameOnly.
Event Open Chat
├─ Set Input Mode UI Only
└─ Chat ▸ Set Visible (true)
Event On Received ("chat:closed")
├─ Chat ▸ Set Visible (false)
└─ Set Input Mode Game OnlyToggle, don't re-create
Set Visible collapses the browser but keeps it alive, so re-showing never rebuilds the underlying web view. That matters on macOS: a freshly-constructed web view grabs keyboard focus once, which drops held game input (WASD) and shows the OS cursor. Mount once, toggle from then on.
Mac UE 5.7 — keyboard focus does not auto-route
Click-to-type required on Mac UE 5.7
Setting Slate keyboard focus on a HUD widget (so the React <input> receives keystrokes without a click) does NOT work on Mac UE 5.7. A physical mouse click into the input is required to start typing. Esc/Enter close paths are unaffected once the input has been clicked once.
Tried and didn't help on Mac 5.7:
UWidget::SetKeyboardFocus()on the browser after switching input mode- Overriding focus reception to forward
FReply::SetUserFocus(SWebBrowser) - Making the widget focusable explicitly
Slate focus reaches the widget, but the Slate→CEF keyboard routing is broken on Mac UE 5.7 (the same regression family as transparency). Works on Windows and UE 5.6.1.
Workaround
Accept one click-to-type on Mac 5.7. Auto-focus is expected to work again on UE 5.8 — but this is pending PIE verification; keep the click-to-type path on 5.8 until you confirm Slate→CEF focus routing works there.