-
Notifications
You must be signed in to change notification settings - Fork 424
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
Feature request - Action option or global handling of 'outside' events #656
Comments
It would be great to have an 'outside' event. |
lb-
pushed a commit
to lb-/stimulus
that referenced
this issue
Jun 20, 2023
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the controlled element - Closes hotwired#656
Put this PR together, hope that is ok. #695 |
lb-
pushed a commit
to lb-/stimulus
that referenced
this issue
Jun 21, 2023
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the element with the attached action - Closes hotwired#656
lb-
added a commit
to lb-/stimulus
that referenced
this issue
Jun 21, 2023
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the element with the attached action - Closes hotwired#656
lb-
added a commit
to lb-/stimulus
that referenced
this issue
Jun 21, 2023
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the element with the attached action - Closes hotwired#656
lb-
added a commit
to lb-/stimulus
that referenced
this issue
Jun 26, 2023
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the element with the attached action - Closes hotwired#656
lb-
added a commit
to lb-/stimulus
that referenced
this issue
Aug 20, 2023
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the element with the attached action - Closes hotwired#656
lb-
added a commit
to lb-/stimulus
that referenced
this issue
Feb 7, 2024
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the element with the attached action - Closes hotwired#656
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
The action options and global listeners are incredibly powerful. However, it would be great to fill in a common use case gap of an event that triggers only when outside the element is clicked.
Example use cases include focus traps, tooltips that close when something else it focused or clicked on, modals that can close when the user clicks outside the modal, dynamic form behaviour where blur is not suitable.
Proposed usage
Alternative solutions
Links
outside
directive https://alpinejs.dev/directives/on#outsideThe text was updated successfully, but these errors were encountered: