shadcn-admin icon indicating copy to clipboard operation
shadcn-admin copied to clipboard

[BUG]: Modal Dialog form field focus is broken

Open PerryCodes opened this issue 10 months ago • 2 comments

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:

  1. Go to 'User List' page
  2. Click on 'Add User' button
  3. Observe the 'First Name' Input field has focus
  4. Press the 'Tab' key OR Attempt to click the 'Last Name' Input field with the mouse
  5. 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

PerryCodes avatar Feb 21 '25 23:02 PerryCodes

This issue is stale because it has been open for 15 days with no activity.

github-actions[bot] avatar Mar 10 '25 18:03 github-actions[bot]

Tested this fix and it seems to work great. Thank you Ali.

PerryCodes avatar Mar 11 '25 21:03 PerryCodes

Thanks for pointing this out @PerryCodes

satnaing avatar Mar 25 '25 11:03 satnaing