focus is not set to yes-button in modal dialog #204
-
I want to conditionally open a modal dialog on the server side. If the condition is true, then I open the dialog with PrimeFaces.current().executeScript("PF(widgetVar).show()"). This works great, but the focus is not placed on the yes button. The call from the UI to the backend occurs via the action attribute in a p:commandLink element. The active element is still the link I've clicked. If I open the same dialog in the same p:commandLink element via oncomplete 'PF(widgetVar).show()', then the dialog opens and the focus is set to the yes button. The dialog is a p:dialog in which the focus is set to the yes button via the focus attribute. Do you have an idea what I can do to ensure the focus is set correctly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Interesting, maybe you can call applyFocus manually with a timeout. public void serverSideMethod() {
PrimeFaces.current().executeScript("PF('widgetVar').show()");
PrimeFaces.current().executeScript("setTimeout( () => PF('widgetVar').applyFocus(), 100 )")
} |
Beta Was this translation helpful? Give feedback.
Interesting, maybe you can call applyFocus manually with a timeout.