Skip to content

MinSize ignored if Split created on invisible DOM Elements #798

Open

Description

@jakerdy

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.

Activity

  1. rhssiiy commented on May 16, 2024

    @rhssiiy

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions