In ScriptUI using Photoshop’s UXP.
Spectrum’s sp-label causes a gap that I don’t understand.
-Plugin Sample-
When I use sp-label, there is a strange gap behind it.
It seems to occur when the number of characters is short.
I have tried adjusting the margins and padding in CSS, but could not resolve this gap.
I also checked inside sp-label.
The size does not change when I set the margins and padding to zero.
It does not change when the parent factor is also included and set to zero.
So did you check in the right window what styles you have for that sp-label (you excluded that from your screenshot)? Is there a specific reason why you think margins or paddings should change the behaviour (even after there was a reply about the width)?
I’m checking by changing the [Nateve] part.
I’ve set all margins, padding, etc. to zero.
I don’t seem to have specified any widths.
Only the gap on the right side remains empty.
sp-label is Web Components.
Web Components has shadow DOM which is separated from outside scope.
according to MDN, Web Component have closed mode or open mode.
but in case of closed mode, accessing from outside is impossible.
and It seems like it has closed mode (because shadowRoot property returns null).
probably I suppose so.
Thank you for your valuable information.
I have read your Blog before.
My knowledge of the API and DOM is not good enough.
I have not been able to find a solution to this kind of problem.
It takes me a lot of time to investigate.
I did not know that I could check the internal access in the logs like this.
I would like to try it once.
I will leave the UI part for now and make the contents first.
Inspect label and not div. In your last screenshot I see you’re inspecting the div, which is highlighted. Label should be highlighted. Then you will see label styles on the right
OK, so most likely this Spectrum element has some stuff going inside of it. That’s why I don’t really like them, but they are good with theme support. Spectrum elements are basically wrappers of something more as I understand them. And that something is not exposed to the outside in any way. Also it’s not possible to change these inner styles in any way.
@Majji seems to be on to something, that there’s a 40px width somewhere, but it’s not the label. I didn’t dig deep, but what @shuji explains seems reasonable and confirms my thoughts.
This is just another limitation/bug on Adobes side I suppose
@hideo Inspection of styles applied on sp-label is not possible. But I can assure you that removing the min-width from the sp-label can resolve the current issue. <sp-label style="min-width: none">HTML</sp-label>