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

Sl-Select clipping content in the dropdown menu #1018

Closed
dsaniel opened this issue Nov 21, 2022 · 2 comments
Closed

Sl-Select clipping content in the dropdown menu #1018

dsaniel opened this issue Nov 21, 2022 · 2 comments
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@dsaniel
Copy link

dsaniel commented Nov 21, 2022

Describe the bug

My sl-select menus are being set to the same size as the container which is causing the content to be clipped.

This seems to be happening here.

Not sure if this is a feature or a bug, but if it is a feature I was wondering if there's any way to disable it.

To Reproduce

Add a sl-select to a page and add different sized options, then make sure the select has no width or min-width so that it conforms to it's contents size, select the shortest entry and the open the menu again.

Screenshots

Screen Shot 2022-11-21 at 6 06 18 AM

@dsaniel dsaniel added the bug Things that aren't working right in the library. label Nov 21, 2022
@claviska
Copy link
Member

This is by design. The menu should be the same width by default. This is done with JavaScript because it's not possible to do it with pure CSS given the way the internals are structured.

However, you can target the menu's width like this:

sl-select::part(menu) {
  width: auto;
}

Unfortunately, the placement is currently top/bottom, which puts the menu in the center of the trigger and looks odd. It should be anchored to the top-start/bottom-start of the control, which would allow for this type of customization.

I've fixed that in 8b2c090, so this will be possible in the next release.

Result:

CleanShot 2022-11-21 at 16 15 02@2x

@dsaniel
Copy link
Author

dsaniel commented Nov 21, 2022

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

2 participants