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

MinSize ignored if Split created on invisible DOM Elements #798

Open
jakerdy opened this issue Feb 10, 2024 · 1 comment
Open

MinSize ignored if Split created on invisible DOM Elements #798

jakerdy opened this issue Feb 10, 2024 · 1 comment

Comments

@jakerdy
Copy link

jakerdy commented Feb 10, 2024

Hi, there is a problem with minSize.
If Split created on hidden DOM node, this part of initialization logic at split.js @ 694, uses getBoundingClientRect. But if DOM nodes invisible at this moment (parent display:none) rect will be zero-sized, and minSize will be overwritten with 0 value. But obviously size is not === 0, it just invisible at the moment. When hidden Split became visible, it will ignore specified minSizes.

@rhssiiy
Copy link

rhssiiy commented May 16, 2024

If anyone is interested, there is a workaround:

const split = Split(..., {
    minSize: 0,
    onDrag: (sizes) => {
        if (sizes[0] < 10) split.setSizes([10, 90]);
        if (sizes[1] < 10) split.setSizes([90, 10]);
    }, ...

All sizes are in percentages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants