Skip to content
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

[tooltip] must not be cropped by owning overflow viewport #2972

Closed
mvorisek opened this issue Jan 7, 2024 · 6 comments
Closed

[tooltip] must not be cropped by owning overflow viewport #2972

mvorisek opened this issue Jan 7, 2024 · 6 comments
Labels
type/discussion Anything which is up for discussion type/feat Any feature requests or improvements

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Jan 7, 2024

Bug Report

Repro

https://jsfiddle.net/bjptg85n/

I belive no FUI component must use position: relative as it does not play well with overflow and it seems there is no way to recover from the cropped viewport then.

Screenshot

  1. cropped by owning overflow viewport

image

  1. badly positioned

image

Version

2.9.3/latest

@mvorisek mvorisek added state/awaiting-investigation Anything which needs more investigation state/awaiting-triage Any issues or pull requests which haven't yet been triaged type/bug Any issue which is a bug or PR which fixes a bug labels Jan 7, 2024
@lubber-de
Copy link
Member

Tooltip is a css only solution which needs position relative to make sure the tooltip appears next to the related element.

@lubber-de lubber-de added state/wont-fix Anything which isn't going to be fixed and removed type/bug Any issue which is a bug or PR which fixes a bug state/awaiting-investigation Anything which needs more investigation state/awaiting-triage Any issues or pull requests which haven't yet been triaged labels Jan 7, 2024
@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 7, 2024

Yes, but consider any viewport with scroll, like a table. Such viewport needs overflow.

And as the viewport is needed, position: relative cannot be used.

I belive this must be fixed as the usecase of viewport with scroll and tooltip inside is legit.

@lubber-de
Copy link
Member

I think, this isn't fixable via CSS only, as we cannot detect (yet) via CSS if an element is actually overflown or wrapped
If one needs this inside an overflowing container, the regular JS "popup" needs to be used instead.

@lubber-de
Copy link
Member

After a quick investigation, the only fix i can offer is an additional variation class like "absolute" as always using "absolute" will break lots of cases.
For example doing this for https://fomantic-ui.com/modules/popup.html#tooltip-position it will result in
image

I also cannot tell if it would be ok for each inline element like the icon you used in the jsfiddle

As i cannot determine a general approach, i can only think of some custom support like

    [data-tooltip][data-variation~="absolute"] {
        position: absolute;
    }

would support your use case. (i am not yet sure if "absolute" would be a good enough term though

<span class="ui icon link " data-tooltip="foo" data-variation="absolute"><i class="ui icon info circle blue"></i></span>

See https://jsfiddle.net/lubber/ghuxpe80/
image

@lubber-de lubber-de added type/feat Any feature requests or improvements type/discussion Anything which is up for discussion and removed state/wont-fix Anything which isn't going to be fixed labels Jan 7, 2024
@lubber-de
Copy link
Member

The "absolute" setting has one drawback: it wont be part of the scrolling container anymore. If you scroll down, the icon gets misplaced (however the tooltip is still working fine :D)
image

Try to scroll down inside the containers
https://jsfiddle.net/lubber/ghuxpe80/2/

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 7, 2024

https://jsfiddle.net/x4fkmc7L/ is the best I managed to fix it but it is not a solution, as it requires different HTML structure and known size of the internal content.

I am closing this issue as we should use Fomantic-UI Popup - I agree with #2972 (comment) - which solves this issue by placing the tooltip div outside the wrapping div (the one with overflow set).

@mvorisek mvorisek closed this as completed Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/discussion Anything which is up for discussion type/feat Any feature requests or improvements
Projects
None yet
Development

No branches or pull requests

2 participants