-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Jatin issue#3303 #3314
Jatin issue#3303 #3314
Conversation
The issue stemmed from the use of a setTimeout in the onBlur handler that closed the project options too quickly. Specifically, the setTimeout(() => dispatch(closeProjectOptions()), 0) was causing the options to close even if the user had not finished interacting with the menu. This was particularly problematic with trackpad input, where the timing of the events could be misinterpreted.
The issue stemmed from the use of a setTimeout in the onBlur handler that closed the project options too quickly. Specifically, the setTimeout(() => dispatch(closeProjectOptions()), 0) was causing the options to close even if the user had not finished interacting with the menu. This was particularly problematic with trackpad input, where the timing of the events could be misinterpreted.
@raclim, I fixed the test issues. Sorry for these— it is my old pull request, and I didn't focus on checking the tests earlier. |
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.
Thanks for taking a look into this!
I think the fix here might not be the best approach, as we probably want to keep setTimeout()
to prevent the menu options from closing too soon and to ensure that the project options close after the action has been complete.
In the original issue, it links to another PR that probably was the cause, so I think trying to reset some of its changes and investing from there could be a start! I'm thinking that one approach could be to implement a useEffect()
to handle open and closing the dropdown when the state of projectOptionsVisible
changes, rather than using onBlur
and onFocus
to resolve both this issue and the one where the project options dropdown doesn't close when a user clicks outside of it.
@raclim i tried you Approach and it is actually much better than the OnBlur and Onfocus method Please review these again... ugh : ) |
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.
Thanks for the update on this, I'm glad that it seems to work! I removed the extra comment and added back in the onContextMenu
prop just to try to keep the same behavior, but feel free to provide any additional comments on it if you feel otherwise!
Fixes #3303
Changes:
Removed of the setTimeout(() => dispatch(closeProjectOptions()), 0); allows the project options to remain open without prematurely closing when interacting with the menu, especially when using trackpads.
I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123