Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add focusOnShow property to Dialog #988
There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeReact PRO Support where support is provided within 4 business hours
I'm submitting a ... (check one with "x")
Codesandbox Case (Bug Reports)
note: this is the same as the code on the dialog example found on the primereact site, but it does focus on a different button
When opening a dialog it will focus the first button it can find (found in the code, tested with disabling). On the site and in the codepen it's fine since it will focus a maximize button or the yes button. However, it focusses the close button in our application. This means when the user presses enter after opening the dialog it closes.
When opening the dialog it should not autofocus a button.
Minimal reproduction of the problem with instructions
I found the code where it sets the focus. but seems deliberate. If it could be made as an opt out would already work. Or explanation seems a bit random to focus on the first button you can find.
Removing line 105 seems to fix it for me, but it is also the only reference to the focus function written above, that's why it seems deliberate.
Please tell us about your environment:
3.1.4 and also tested on 3.1.8