Skip to content

Support listeners on gutter children #354

Open
@pjjanak

Description

@pjjanak

For example the following:

<Split
    columnMinSizes={[500, 20, 350]}
    render={({
        getGridProps,
        getGutterProps,
    }) => (
        <div {...getGridProps()}>
            <div>Column A</div>
            <div {...getGutterProps('column', 1)}>
                <div>Click me</div>
            </div>
            <div>Column B</div>
        </div>
    )
/>

If you click on the child div of the gutter the following error is produced:

split-grid.es.js:209 Uncaught Error: Unable to determine grid template tracks from styles.

It would seem that the ultimate problem is an assumption within the Gutter's startDragging function:

...
if (this.element) {
    this.grid = this.element.parentNode;
} else {
    this.grid = e.target.parentNode;
}
...

Given this code, a gutter cannot have children since the Gutter code will always assume that the parent node of the element being clicked is the grid, where this is not the necessarily always the case. I think if I was ale to set this.element on the Gutter that would probably fix my issue, but I don't see a way to do that with the react library.

That said, it would seem to me that the Gutter code here should continue searching parent nodes until it finds the one that is actually the grid, rather than relying on a strict DOM structure.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions