Repository navigation
Conversation
bwajtr
marked this pull request as ready for review
March 16, 2023 15:29
vursen
approved these changes
Mar 17, 2023
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
|
Kudos, SonarCloud Quality Gate passed!
|
bwajtr
deleted the
5667-tooltip-not-displayed-after-items-are-sorted-in-$repeat-directive-chrome-edge-only
branch
March 17, 2023 08:43
bwajtr
added a commit
that referenced
this pull request
Mar 17, 2023
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
bwajtr
added a commit
that referenced
this pull request
Mar 20, 2023
Collaborator
|
This ticket/PR has been released with Vaadin 24.1.0.alpha1 and is also targeting the upcoming stable 24.1.0 version. |
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.








Description
vaadin-tooltipuses anIntersectionObserverto watch for the target full visibility. If the user scrolls the page in a way that the target of the tooltip is only partially visible (or not visible at all), the tooltip overlay - if previously shown - is automatically hidden too. This helps to prevent a situation when we would show a tooltip for an element which is not visible.Issue #5667 reported buggy behaviour of this mechanism when rendering tooltips using lit $repeat directive. However, further investigation showed that it's a more general problem, and the buggy behaviour is observed when you are simply moving elements from place to place (which is what $repeat internally does) - but it's buggy only in Chromium based browsers.
Even though all involved elements always stay in the viewport Chromium-based browsers trigger
IntersectionObserverwith a pair ofIntersectionObserverEntryinstances when you move one of the elements. This does not happen every time, but only in specific situations - e.g. moving the element before some other element in the DOM. Surprisingly, it does not happen when moving in the other direction. Firefox and Safari do not produce any IntersectionObserver events whatsoever.As I said, Chromium produces two instances of
IntersectionObserverEntryand supplies it to the observer callback at once. From the content of the entries, it seems like the first entry is for an act of removing the element from the viewport (withisIntersecting==false) and the second entry is for placing it back to the viewport (withisIntersecting==true). I've reported this behaviour to Chromium bug database, because I don't think it's right - it should be clarified the least.The problem in our code was that the Observer callback was processing always only the first entry from the
IntersectionObserverEntrieslist. The code probably assumed, that because we are always observing only a single target, we will always get a single entry in the callback. In the case of buggy behavior, this is not true. Our code processed only the entry whereisIntersecting==false, making it think that the target element was removed from the viewport and never returned.I think the reasonable fix here is to always process all the entries which are passed to the
IntersectionObservercallback. That'll force the tooltip to process also the second entry in the list, whereisIntersectingis again set totrue.Fixes #5667
Type of change
Checklist