How can I set focus on an element when switching the Container View or opening a modal dialog? Inside the dialog, all focus methods work without any issues. However, when opening a new dialog, I am unable to set the focus – the focus()
function on the element does not work.
Hello @peregrinus,
Are you using a tabbed container and switching between the views? What do you mean by dialog, are you referring to the "Event Handler"?
Can you share a screenshot of the component.focus()
being called but not running?
There is a unique quirk of Retool where events for components can't occur until they are rendered to the page, if you are opening a modal or changing between tabs of a container.
You may need to have a delay before invoking .foucs()
as it sounds like you may be calling .foucs()
slightly too early before the component to be focused is rendered to the page
1 Like