-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialog: Focus from input lost in very short time after dialog opened #11860
Comments
Description in this ticket: "Since PF 13.0.6, setting the focus with the 'focus' attribute in the 'dialog' no longer works. The element briefly gains focus and then immediately loses it again. This still worked in PF 13.0.5." looked like it could be related |
Looks like it is caused by this change: |
Thanks for the reproducer let me debug this issue. |
@martin654 great reproducer this was tricky to debug. What is happening is both dialogs called
Working on a fix |
I included a monkeyPatch in your test.js can you give it a try? if (PrimeFaces.widget.Dialog) {
PrimeFaces.widget.Dialog.prototype.returnFocus = function () {
var el = this.focusedElementBeforeDialogOpened;
if (el) {
// #11860 do not return focus if other dialogs are still open
var otherDialogs = $(".ui-dialog:visible").length > 0;
if (otherDialogs) {
return;
}
setTimeout(function () {
el.focus({ preventScroll: true });
}, 100);
}
};
} |
…logs still open
Fix primefaces#11860: 13.0.10 Dialog returnFocus when other dialogs open
Fix primefaces#11860: 13.0.10 Dialog returnFocus when other dialogs open
Fix primefaces#11860: 13.0.10 Dialog returnFocus when other dialogs open
@melloware Thank you for the fix, works great in 13.0.10. |
Describe the bug
Hi,
we have many dialogs in our app and our users were uset that focus was set inside the dialog when dialog opened - for example into first input component. That worked great in version 13.0.5 but since 13.0.6 this doesn't work anymore. I tried it with 13.0.9 and it is still broken.
In the browser you can see that focus is applied for short amount of time and then lost.
Please see attached reproducer.
Thanks
Reproducer
Please see attached reproducer:
primefaces-test_dialog_focus.zip
Expected behavior
I expect PF to work the same as in PF version 13.0.5 and earlier...
PrimeFaces edition
Elite
PrimeFaces version
13.0.6
Theme
No response
JSF implementation
Mojarra
JSF version
4.0.7
Java version
17
Browser(s)
Chrome
The text was updated successfully, but these errors were encountered: