Repository navigation
Conversation
Per https://floating-ui.com/docs/autoupdate#usage: > It’s important that this function is only called/set-up when the > floating element is open on the screen, and cleaned up when it’s > removed. Otherwise, it can cause severe performance degradation, > especially with many floating elements being created. This commit includes a mutation observer to watch for changes to the element to trigger Floating's `autoUpdate()`. We still attempt to start tracking the element on init in case it is visible to begin with. An idempotent `start()` allows for more confident code without having to check the value of the `release` function to determine state. We now use a more obvious named flag for whether or not we're tracking the element with `autoUpdate()`. Elements hidden by x-show, x-cloak, classes, etc. no longer keep scroll/resize listeners running. **NB**: `$anchor.x` and `$anchor.y` now stay at 0 until the element is first shown. An element using `x-show` without `x-cloak` will briefly start tracking and then stop after Alpine init.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per https://floating-ui.com/docs/autoupdate#usage:
This commit includes a mutation observer to watch for changes to the element to trigger Floating's
autoUpdate(). We still attempt to start tracking the element on init in case it is visible to begin with.An idempotent
start()allows for more confident code without having to check the value of thereleasefunction to determine state. We now use a more obvious named flag for whether or not we're tracking the elementwith
autoUpdate().Elements hidden by x-show, x-cloak, classes, etc. no longer keep scroll/resize listeners running.
NB:
$anchor.xand$anchor.ynow stay at 0 until the element is first shown. An element usingx-showwithoutx-cloakwill briefly start tracking and then stop after Alpine init.