[BUG]: Modal Dialog form field focus is broken
Describe the bug Both mouse and keyboard methods for establishing focus on form fields are not working correctly.
To Reproduce Steps to reproduce the behavior:
- Go to 'User List' page
- Click on 'Add User' button
- Observe the 'First Name' Input field has focus
- Press the 'Tab' key OR Attempt to click the 'Last Name' Input field with the mouse
- In either case, incorrect behavior is observed. When pressing 'Tab', the Dialog becomes focused instead of the next form field. Pressing 'Tab' again returns focus back to 'First Name'. When using the mouse, the first click also sets focus to the Dialog. A second click is necessary for 'Last Name' to receive focus.
Expected behavior In both cases, with the keyboard or mouse, I would expect the "Last Name" field to receive focus. Where 'Tab' presses are concerned, I would never expect the Dialog to receive focus. The is the behavior you see in the official documentation for the shadcn/ui Dialog component here: https://ui.shadcn.com/docs/components/dialog
Screenshots n/a
Additional context n/a
This issue is stale because it has been open for 15 days with no activity.
Tested this fix and it seems to work great. Thank you Ali.
Thanks for pointing this out @PerryCodes