|
@@ -243,13 +243,13 @@ export const applyEvent = async (event, socket) => {
|
|
if (event.name == "_set_focus") {
|
|
if (event.name == "_set_focus") {
|
|
const ref =
|
|
const ref =
|
|
event.payload.ref in refs ? refs[event.payload.ref] : event.payload.ref;
|
|
event.payload.ref in refs ? refs[event.payload.ref] : event.payload.ref;
|
|
- const focus = ref?.current?.focus;
|
|
|
|
- if (focus === undefined) {
|
|
|
|
|
|
+ const current = ref?.current;
|
|
|
|
+ if (current === undefined || current?.focus === undefined) {
|
|
console.error(
|
|
console.error(
|
|
`No element found for ref ${event.payload.ref} in _set_focus`,
|
|
`No element found for ref ${event.payload.ref} in _set_focus`,
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- focus();
|
|
|
|
|
|
+ current.focus();
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|