Skip to content
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

Refact: hide dropdown prompt & palette when clicked outside #223

Merged
merged 4 commits into from
Apr 12, 2023

Conversation

tnga
Copy link
Contributor

@tnga tnga commented Apr 11, 2023

Added an event listener to hide dropdown,
when anything other than the dropdown is clicked,
implemented via a click event.

Added an event listener to hide prompts,
when anything other than the dropdown is clicked,
implemented via a click event.
Added an event listener to hide palette color,
when anything other than the dropdown palette is clicked,
implemented via a click event.
Copy link
Owner

@ztjhz ztjhz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at this PR #211.

The event listener should only be added when the dropdown is toggled and removed when the dropdown is removed. Otherwise, there will be multiple mousedown event listeners for every rendered CommandPrompt there is.

Changed the event listener conditions for mousedown events,
so they are only added when dropdown menu or color palette is visible.
@tnga
Copy link
Contributor Author

tnga commented Apr 12, 2023

Please look at this PR #211.

The event listener should only be added when the dropdown is toggled and removed when the dropdown is removed. Otherwise, there will be multiple mousedown event listeners for every rendered CommandPrompt there is.

Well noted, it makes sense. Fixed with a new commit.

@ztjhz ztjhz merged commit 0269740 into ztjhz:main Apr 12, 2023
ElonGaties added a commit to ElonGaties/BetterChatGPT that referenced this pull request Apr 12, 2023
Refact: hide dropdown prompt & palette when clicked outside  (ztjhz#223)
ElonGaties added a commit to ElonGaties/BetterChatGPT that referenced this pull request Apr 12, 2023
Refact: hide dropdown prompt & palette when clicked outside  (ztjhz#223)
@tnga tnga deleted the dropdown branch April 20, 2023 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants