vscode-elements / elements

Web component library for developing Visual Studio Code extensions
https://vscode-elements.github.io
MIT License
156 stars 27 forks source link

SingleSelect: when inside a collapsible, popup options are truncated #178

Closed neko-para closed 1 month ago

neko-para commented 1 month ago

QQ_1728394456930

bendera commented 1 month ago

This is a complex issue and there isn't any simple solution to fix it. I added two options to the components that will help you fix this issue.

vscode-collapsible::part(body) {
  overflow: visible;
}

With this CSS, the dropdown won't be truncated, but the bottom margin of the last element will push down the next element after the Collapsible component. Therefore it's your responsibility to fix this.

Screenshot 2024-10-08 230940

I published a pre release version, please let me know if this solve your issue. You can install with: npm i @vscode-elements/elements@next

neko-para commented 1 month ago

QQ_1728443633206

Seems that with the css everything works fine, and no extra margin appears. Maybe it's because there's an extra div between collapsible and single-select?

            <vscode-collapsible title="abc" open>
                <div id="indexPanel">
                    <vscode-single-select>
                        <vscode-option>abc</vscode-option>
                        <vscode-option selected>def</vscode-option>
                    </vscode-single-select>
                </div>
            </vscode-collapsible>
#indexPanel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    padding: 0.5rem;
}
bendera commented 1 month ago

Only the children with margins are affected. In my example, the last line is a <p> tag with default vertical margins.