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

Widget should determine its own clippedBy #3838

Closed
ExtAnimal opened this issue Dec 1, 2021 · 0 comments
Closed

Widget should determine its own clippedBy #3838

ExtAnimal opened this issue Dec 1, 2021 · 0 comments
Labels
feature request resolved Fixed but not yet released (available in the nightly builds)

Comments

@ExtAnimal
Copy link

ExtAnimal commented Dec 1, 2021

clippedBy is a hidden Widget config which tells a floating widget which scrolling elements create the bounding viewport which clips its alignTo target.

This is how tooltips know when their target has been scrolled out of view, and how they align to the visible center of the target.

This should be calculable at alignTo time when the align target is an HTMLElement:

I suggest a new static Scroller method:

/**
 * Returns the scrolling ancestors which provide the clipping viewport for the passed element.
 */
static getClippedBy(target) {
    const
        clippedBy = [],
        v         = target.ownerDocument.defaultView;

    for (let el = target; el != document; el = el.parentElement) {
        const s = v.getComputedStyle(el);

        if (isScrollable[s.overflowX] || isScrollable[s.overflowY]) {
            clippedBy.push(el);
        }
    }
    return clippedBy;
}
@ExtAnimal ExtAnimal added the resolved Fixed but not yet released (available in the nightly builds) label Jan 11, 2022
@isglass isglass closed this as completed Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request resolved Fixed but not yet released (available in the nightly builds)
Projects
None yet
Development

No branches or pull requests

2 participants