Re: [csswg-drafts] [css-forms-1] UA styles for base appearance listbox select elements (#12510)

So we have a variety of options for sizing listboxes with base appearance:
1. Ignore the size attribute and allow the select to grow to fit its contents.
    * Pros: allows developers to easily override height and doesn't require any magic.
    * Cons: particular number given to the size attribute doesn't influence the height.
2. Use a calc() expression
    * Pros: allows developers to easily override height and doesn't require any magic.
    * Cons: When options have more that one line of content or custom padding, then height won't perfectly match a specific number of options.
3. Set line-clamp based on size attribute
    * Pros: always sets height perfectly however options are rendered
    * Cons:
      * Unclear if its easy for authors to override the height by manually setting the height attribute.
      * Can't prototype due to lack of implementation; I got feedback that it won't be ready for a while.
      * Diverging proposals for this property in different levels of the spec.
4. Use intrinsic sizing
    * Pros: allows developers to easily override height and always sets height perfectly however options are rendered
    * Cons:
      * Might not be easy to explain how this works given existing features.
      * I've heard that there might be circularity issues, but I don't have an example.

I believe that using calc() is best because it allows the size attribute to do something, and if it doesn't perfectly match a number of options that is OK because sizing listboxes to fit an exact number of options is not a typical use case.

I'm also ok with options 1 and 4, but I'd prefer not to use line-clamp because of:
- the outstanding issues that will make it very hard for me to use
- if it makes the height property stop working, it will be a major annoyance for developers
- as I mentioned in the last point, making it perfectly size interesting options in all cases is not a typical or important use case.

-- 
GitHub Notification of comment by josepharhar
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12510#issuecomment-3628495959 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 8 December 2025 18:33:40 UTC