Add "x-stop" directive to prevent further DOM walking #1036
skttl
started this conversation in
3. Feature Ideas
Replies: 2 comments 3 replies
-
That doesn't need to go on the body. Events bubble up to the window and you can watch them from anywhere. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Just to add, this sort of idea was previously discussed in #395 and #393 but the outcome was that it wouldn't be implemented unless people could demonstrate more of a need. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As stated in https://ryangjchandler.co.uk/articles/5-simple-alpinejs-tips-and-tricks#1-keep-your-components-small, large components, like adding
x-data
to<body>
can be a performance problem. Would it help if we had something likex-stop
to stop walking through specific DOM nodes?A typical usecase I have is this
I use this to determine if the user is using the keyboard for navigating (so I can enhance the focus styles), or if a modal/dialog/whatever is visible, so I don't want the page to scroll beneath.
In this I could then add something like
<div x-stop
, to have Alpine not walk the contents of that div. My complete markup could then beBeta Was this translation helpful? Give feedback.
All reactions