-
Notifications
You must be signed in to change notification settings - Fork 85
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
fix: show tooltips when target is partially visible #5932
Conversation
Kudos, SonarCloud Quality Gate passed!
|
}); | ||
|
||
describe('target is fully visible', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this suite / test, as the test case should already be covered by the two previous tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only problem I can think of is positioning tooltip for the partially visible element:
![Screenshot 2023-06-02 at 10 46 38](https://private-user-images.githubusercontent.com/10589913/242821280-63bff753-5111-4061-951a-1fda6de8dea1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NTI0NTgsIm5iZiI6MTczOTk1MjE1OCwicGF0aCI6Ii8xMDU4OTkxMy8yNDI4MjEyODAtNjNiZmY3NTMtNTExMS00MDYxLTk1MWEtMWZkYTZkZThkZWExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDA4MDIzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhZWFiZThlYjNhMjVkYTA4YTUyYzMzNWM5MjZjMTI2MWVlODU2ZjA4MzFmN2ViNzNjOTMxMzBmYTE2NDNhNjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.COHtkb2BbrIyNkLse6PEunm0_-wurpI4bMqtkAICTTM)
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. |
Co-authored-by: Sascha Ißbrücker <[email protected]>
Co-authored-by: Sascha Ißbrücker <[email protected]>
Co-authored-by: Sascha Ißbrücker <[email protected]>
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