-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add CSS listbox size parameters #2
Conversation
* Remove distinction between first and second themed row on the demo page. Use demo-logo for both instead of omitting the image the second time. * Add right-aligned to the example. This uses hardcoded CSS right now, to be improved in #2. * Fix inconsistent indentation in the demo/index.html file.
@CodeSandwich Thanks. I agree with your intent and most of the implementation. I think the default state regresses a bit as-is, because 60vh feels too narrow in most cases I've seen. And increasing it to Previously, we used Would something like What do you think? I think it'd be great to have the default experience take the available space on mobile (i.e. not significantly less, and also not overflow from the parent 100%). |
I've committed the clean ups to the demo in 21eaf97 as a start. |
I agree with all your width concerns, but I think that they are addressed by
This is covered by Maybe breaking up |
@CodeSandwich Thanks for clarifying, I missed the interaction between min-width and width. I made some local changes to that before I did my testing, which I was overly confident in would not affect the outcome. I'll have another look! |
@CodeSandwich I've narrowed down where it goes wrong in the demo. I modified the patch to limit the In that mode, the listbox starts to overflow the document at certain widths, creating a scrollbar: Debugging it further, I realize this is specific to the I've updated my branch to move the width and listbox-width override to the The remaining question then is:
I believe 30rem, is the closest round number to match the previous default of 500px. Is that right? This is a bit wider than the default input width of 20rem, so there is a chance of overflow there, but seems to work out in practice since 60vh is likely (or guruanteed?) to kick in by that point and trim it down, until eventually it matches the width of the input field (20rem), after which both input and listbox shrink together on narrow viewports. Does that sound about right? I've uploaded my amendment at 7b47cbc. Regarding the new CSS variables. The motivation for the variables is currently to create a stable way to set values that are (or likely will) be used in multiple places, or otherwise need to apply via a rule or selector that isn't selectable through public and stable selectors. For example, the theme colors and font sizes are used in various ways that I think are more future proof this way. The Styles API shows which selectors are considered "stable", and that includes |
Thank you for looking so deeply into it! Before diving deeper into your branch, have you tried this PR in its vanilla form, as in checking out commit ce54138 and seeing if things are working as expected? This could be a good starting point, it would be easier to pinpoint the bugs and the unwanted behaviors, because this commit doesn't have layers of patches in the demo yet. This is how ce54138 behaves: Screencast_20231129_121117.mp4 |
Sorry, I haven't noticed the This is why I wonder if splitting |
Could you explain what is your goal of these changes?
It seems to avoid the addition of the CSS variable for width, but the demo page seems to be looking good. |
@CodeSandwich I did test the patch as-is, but it doesn't give me the level of confidence I'd like as the themed mode set both bars to be right-aligned. This left it unclear how the left-aligned case would behave, with uncertainty/ambiguity over the width override (is the value only appropiate for right-aligned? do we require users to calculate a different override for left? or would the default work as-is in a flebox context for left-aligned mode and without overflow bugs?). Those questions reflect the modifications I made locally.
Thanks for mentioning that. The reason I highlighted (promise stability, reduce selector complexity and/or permit re-use) don't cover this, but I like the idea of recommending them. We could evolve that later into a short-list of recommended styles to consider setting, but that's for later. The reason I'm leaning in that direction is that I don't see a way that these could become anything other than explicitily setting 1 specific CSS propertly on 1 specific stable selector. I don't want to discourage setting individual CSS styles, and would likely decline feature requests that add variables for properties we don't set by default. But for built-in ones, especially if it's likely that each user should think about setting it, I think that makes for a fine addition. Let's roll with it! |
Thanks for the de-facto merge! And a separate thank you for all the effort you put into this PR 🎉 The demo is indeed much better now. |
@CodeSandwich You're welcome. I want to clarify that your patch wasn't wrong. It just took me a few tries to understand everything that went into it. We could draw the themed/unthemed line differently and also demo/test the custom width behaviour both left and right aligned (as you did originally). I ended up with a slightly differently opinionated outcome, but this was more the result of me working with it to understand it, than disagreeing on anything in particular. I hope that makes sense! |
Follows-up ca5519d, which moved this from applying last, in a media query, to hide the keyboard short cut on narrow viewports (likely touchscreen devices); to instead apply before the actual style unconditionally, thus never actually applying as it is immediately overriden by another style right below it. The default for `::after`, is already to not exist / be hidden. Ref #2.
Follows-up ca5519d, which moved this from applying last, in a media query, to hide the keyboard short cut on narrow viewports (likely touchscreen devices); to instead apply before the actual style unconditionally, thus never actually applying as it is immediately overriden by another style right below it. The default for `::after`, is already to not exist / be hidden. Ref #2. Closes #4.
This PR attempts to make the default CSS more universal with regard to size. It does a few things:
@media
sections. They were very opinionated, the current approach is more flexible. The viewport width ranges didn't match each other, so there were actually 3 width ranges, each of them with a different set of CSS attributes. The result was that only in the wide viewport the listbox was flexible and good looking, and narrowing it caused glitches..tsmb-form--slash::after
sections closer to each other, so it's easier to follow the slash icon behavior