Repository navigation
fix: show tooltips when target is partially visible - #5932
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
| expect(overlay.opened).to.be.false; | ||
| }); | ||
|
|
||
| describe('target is fully visible', () => { |
There was a problem hiding this comment.
Removed this suite / test, as the test case should already be covered by the two previous tests.
web-padawan
left a comment
There was a problem hiding this comment.
The only problem I can think of is positioning tooltip for the partially visible element:
Could be reproduced with the following HTML in the dev page:
<style>
#container {
width: 200px;
height: 200px;
border: solid 1px #e2e2e2;
overflow: scroll;
}
</style>
<div id="container">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
<button id="test">Test</button>
<vaadin-tooltip text="Testing" for="test"></vaadin-tooltip>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt sapiente fuga unde dolore, harum voluptatibus, similique culpa illo quae eveniet esse. Adipisci omnis beatae delectus iure labore nihil velit quas.
</div>|
As discussed, let's go with the current approach for now. If the positioning turns out to be a problematic use-case then we can consider tweaking the visibility threshold or make the overlay positioning consider the intersection rectangle. |
|
This ticket/PR has been released with Vaadin 24.2.0.alpha1 and is also targeting the upcoming stable 24.2.0 version. |








Description
Currently a tooltip is only shown when its target is fully visible. That is an issue with avatar for example, which uses a negative margin that can pull it out of its scroll container if put right at the edge of it. It can also be confusing that a tooltip doesn't show for an element where only a single pixel is scrolled outside of the view.
This change makes tooltips show if their target is partially visible (even just a single pixel). I considered using some magic number between 0 and 1 for the threshold, but again it could be confusing why tooltips show / hide based on different scroll positions, even though the element is effectively visible for the user.
Fixes vaadin/flow-components#5105
Type of change