On the latest pre-release 22.3.0, the sp-dropdown does not work the same as in 22.2.0. There are a few different issues depending on how they are implemented. Here are 2 examples. The first example is a flex layout. In 22.3.0 the width of the dropdown goes to minimum. I tried numerous ways to assign a width in CSS in the sp-dropdown tags, sp-menu tags and sp-menu-item tags but nothing changes it. When clicking the dropdown, these options have to fit vertically because of the lack of space.
In the second example, there is extra space on the bottom. I tried setting margins and padding to zero and also to negative for the dropdowns and also the div tags. I could not remove the extra spacing.
This image is a comparison of 22.2.0 on the left and 22.3.0 on the right for 2 different UIs.
Thanks for looking into it. When you get more info, can you let me know?
I have several plugins already released on my website that will be affected if 22.3 is released this way. I want to know if I need to change the UIs prior to 22.3 being released or if this will be modified before 22.3 is released.
I can only get the dropdowns with side labels to behave if I take the label out of the layout entirely using some absolute positioning. Should work even when fixed (and works in 22.2), but up to you if you want to use it.
For the dropdowns without labels, you can try using height: 32px, or display: flex; flex-direction: column;, though I’m not clear as to why the latter works.
(Note: I have not validated this on Windows yet, just macOS at the moment.)
OK thanks for the help. I’ll check the work-around for the labels. I may just go away from the side labels too as I did with 2nd UI I posted. Other than the extra spacing on the bottom those were OK. Tomorrow I’ll try what you mentioned to see if it fixes that extra bottom spacing.
I basically need a dropdown box that is as wide as the widest element in the list. If I select the narrowest entry, the longer entries of the dropdown are wrapped into two lines as well, which isn’t how it’s supposed to work out of the box, right?
You’ll need to give your dropdown a minimum width to prevent the wrapping of text elements as the width of the popover is constrained to the width of the dropdown element. If it’s not got a minimum width, it can reduce beyond what makes a lot of sense. (As for the HTML Playground – an update is coming there that changes the UI significantly, so that error won’t happen in the next push.)
I don’t really need any “flex-ing” for my dropdown container. But if I use the straight-forward code withouth any flex settings applied, the dropdown box still shrink, when a shorter value is selected. That’s not how select boxes behave in HTML out of the box. Why does it happen here? Am I missing something?
Did you use a min-width in the CSS class as Kerri Shotts suggested?
UXP is not a browser and the layout will not behave the same as a browser in many cases. UXP layouts continue to evolve as well as it is brand new to Photoshop.
From what I understand, this wouldn’t fix an issue. The dropdown itself does not expand to the longest value, so if you have a value which takes 500px and you set min-width to 100px, it will still wrap long options to multiple lines, wouldn’t it? (sorry, ATM don’t have how to test it myself)
I haven’t tested the min-width either. It sounds like it is a bug so it doesn’t behave as it should, which is why min-width was required.
When setting min-width, it should force that as a minimum but allow it to expand longer as needed. Max-width would set a maximum and allow it to go shorter as needed. You can use both to allow a range of widths. In my case, I just used width which should have forced it to an exactly fixed width.
In any case, I switched the layout in my plugins and went away from the side label 4 months ago. So I haven’t tested this. My current layout works fine for now. When 22.5 is publicly released I will revisit my layouts. It sounds like a lot of changes are coming. Also, it sounds like the min-width bug will be fixed.
I’ll put development aside for a few days now to cool down. I haven’t got the patience for this any more. Maybe waiting for a few releases until the basic things work is the best option.