Skip to content

Commit 39d6478

Browse files
author
Marc Lundgren
committed
simplify demo
1 parent 34b8d1e commit 39d6478

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

samples/04.api/o.iframe-rpc-focus/webchat.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@
6767
return;
6868
}
6969

70-
const { type } = event.data ?? {};
70+
const { type, target } = event.data ?? {};
7171

72-
// Handle focus commands
7372
if (type === 'WEBCHAT_FOCUS') {
7473
try {
7574
updateStatus('Focusing input...');
7675

77-
if (window.WebChat) {
78-
const sendBoxInput = document.querySelector('.webchat__send-box input');
76+
if (window.WebChat && target === 'sendBox') {
77+
const sendBoxInput = document.querySelector('[data-id=webchat-sendbox-input]');
7978

8079
if (sendBoxInput) {
8180
sendBoxInput.focus();

0 commit comments

Comments
 (0)