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

fix(listeners): close dropdowns when user clicks outside of them #328

Closed
tangjeff0 opened this issue Aug 11, 2020 · 2 comments · Fixed by #369
Closed

fix(listeners): close dropdowns when user clicks outside of them #328

tangjeff0 opened this issue Aug 11, 2020 · 2 comments · Fixed by #369
Assignees

Comments

@tangjeff0
Copy link
Collaborator

tangjeff0 commented Aug 11, 2020

parent issues: #59 #97

demo: in Roam, slash menu and inline search have slightly different close conditions.

  • Slash menu closes when click anywhere outside of block.
  • Inline search closes when click outside of [[_]], where _ is your caret

steps:

  • create a MOUSEDOWN listener in listeners
  • if a close condition is met, dispatch an event
  • in blocks, if that event is dispatched, reset search/type to nil. this should close either dropdown
@alaq
Copy link
Contributor

alaq commented Aug 28, 2020

I'm going to take a look at this!

@tangjeff0
Copy link
Collaborator Author

tangjeff0 commented Aug 28, 2020

Great! If there is a way to do this locally, that doesn't use global listeners, that would be ideal. I think refs let you do this but not sure.

All the dropdowns where this would apply:

  • context-menu when clicking on bullets
  • page menu
  • inline search
  • slash command menu
  • though not a dropdown, Athena could use this too

@tangjeff0 tangjeff0 changed the title fix(listeners): close out of slash and inline menus when open and user clicks outside of the menu or block fix(listeners): close dropdowns when user clicks outside of them Aug 28, 2020
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 a pull request may close this issue.

2 participants