-
Notifications
You must be signed in to change notification settings - Fork 2.1k
5527 multiple file popups #5905
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
base: main
Are you sure you want to change the base?
5527 multiple file popups #5905
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where users could open multiple file picker or directory chooser dialogs by rapidly clicking the corresponding buttons. The fix adds state tracking to prevent re-opening dialogs while one is already active.
Key changes:
- Added state management to track when pickers/choosers are open
- Disabled buttons and added visual feedback (opacity) during picker/chooser operations
- Wrapped async operations in try-finally blocks to ensure cleanup
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ui/desktop/src/components/bottom_menu/DirSwitcher.tsx | Adds isDirectoryChooserOpen state, disables button during directory selection, and prevents tooltip from showing when chooser is active |
| ui/desktop/src/components/ChatInput.tsx | Adds isFilePickerOpen state and disables file attachment button during file selection |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
…active Signed-off-by: benjamindrussell <[email protected]>
3bcc306 to
70a4c2e
Compare
70a4c2e to
f30a0f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
| if (isDirectoryChooserOpen) { | ||
| event.preventDefault(); | ||
| event.stopPropagation(); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, can you explain why just using return; won't work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, returning only exits the handler, it doesn’t cancel the browser’s default behavior or stop the event from bubbling. We could remove preventDefault and add a type="button" to the button, since the default type is submit. TBH it would probably still work fine with just return.
Summary
Added state to track file picker status, disabled the button when file picker open.
Also, not mentioned in the original issue but the same behavior occurs for the directory chooser as well so I went ahead and fixed it.
Added state to track directory chooser status, disabled the button when directory chooser open.
Type of Change
AI Assistance
Testing
Manual Testing
Related Issues
Relates to #5527
Discussion: LINK (if any)
Screenshots/Demos (for UX changes)
Before:

After:

Submitting a Recipe?
Email: