solid-design-system / solid

Monorepo for Union Investment's Solid Design System.
https://solid-design-system.fe.union-investment.de/x.x.x/storybook/
Other
17 stars 3 forks source link

feat: ✨ CSS variable to set max-height of sl-select and autocomplete #985

Open Fl0rianFischer opened 2 months ago

Fl0rianFischer commented 2 months ago

(edited by @mariohamann, original ticket at the bottom)

User Story

As a developer I want to easily override max-height for sl-select and the autocomplete pattern.

Technical Information

We could add --listbox-max-height which is set on the :host and then can be easily overridden.

DoR

DoD

Original ticket ## Current behavior The dropdown of the sd-select displays very weird behavior with many entries ## Expected behavior Dropdown should have max height and scrollable content if there are a lot of options ## Steps to reproduce See video https://github.com/solid-design-system/solid/assets/8488432/67ceb6a3-58af-42b2-9779-47b403c1062e
mariohamann commented 2 months ago

328112724-f39e05ec-cbb9-49dc-946a-40d34eabb203

We currently don't limit the height on porpuse, as the HTML element behaves the same. The package we use under the hood (https://floating-ui.com/) sees, how much space is available on the screen and resizes accordingly. If your application wants to force to a max-height to improve UX for whatever reason, you can easily do that by setting the following:

sd-select::part(listbox){
  max-height: 134px;
  overflow-y: auto;
}

Here is a working example: https://codepen.io/mariohamann/pen/JjVgpxq

We will discuss this with design and maybe we'll provide an easier API for that in future. For that I'm rewriting your ticket, but from my perspective I don't expect this to be done soon. Meanwhile you should be safe using the part above. :)

mariohamann commented 2 months ago

For the thing with the missing border, I just created a new issue: https://github.com/solid-design-system/solid/issues/1042