Skip to content
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 support for label and help text to color picker #1552

Open
haikyuu opened this issue Sep 3, 2023 · 7 comments
Open

Add support for label and help text to color picker #1552

haikyuu opened this issue Sep 3, 2023 · 7 comments
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@haikyuu
Copy link

haikyuu commented Sep 3, 2023

Describe the bug

Docs state label will be displayed if in a slot. But it's not

Demo

https://codepen.io/haikyuu/pen/zYyKBzR?editors=1000

@haikyuu haikyuu added the bug Things that aren't working right in the library. label Sep 3, 2023
@KonnorRogers
Copy link
Collaborator

Hmmm...it seems to work for me.

I think the problem is that your codepen has malformed html. (no closing sl-color-picker)

<sl-color-picker value="#4a90e2">
  <label slot="label"> Color </label>  
- </span>
+ </sl-color-picker>

Let me know if that works!

@claviska
Copy link
Member

From the docs:

The color picker’s label. This will not be displayed, but it will be announced by assistive devices. If you need to display HTML, you can use the label slot` instead.

This was a poor decision I made early on to not show the label. I would almost classify it as a bug. Color pickers should be able to be displayed both with and without a visual label.

We can leave this open as a TODO for this feature.

@claviska claviska added this to the 3.0 (future) milestone Oct 26, 2023
@claviska claviska assigned claviska and KonnorRogers and unassigned claviska Oct 26, 2023
@KonnorRogers
Copy link
Collaborator

@claviska I'm thinking label hidden by default for a patch release, and label shown by default in a 3.0 release? Sound reasonable?

@claviska
Copy link
Member

Makes sense. Let's open an issue for this using the 3.0 milestone so we don't forget to update the default :)

@semiaddict
Copy link

I think the problem is that your codepen has malformed html. (no closing sl-color-picker)

<sl-color-picker value="#4a90e2">
  <label slot="label"> Color </label>  
- </span>
+ </sl-color-picker>

I am facing the same issue, and properly closing all html tags doesn't fix it.
The label is correctly added to the slot, but inside an sl-visually-hidden element.
Here's the dom as seen in FireFox's inspector panel:

image

@claviska
Copy link
Member

@semiaddict This is the correct behavior. The label doesn't currently show as a visible label like form controls. This issue is now a TODO to fix that in 3.0.

@semiaddict
Copy link

@semiaddict This is the correct behavior. The label doesn't currently show as a visible label like form controls. This issue is now a TODO to fix that in 3.0.

Thank you @claviska.

Then maybe the docs deserve a slight modification as it seems to indicate that using a slot instead of the attribute will show the label:

The color picker’s label. This will not be displayed, but it will be announced by assistive devices. If you need to display HTML, you can use the label slot` instead.

@claviska claviska changed the title Color picker label not displayed when provided as part of slot Add support for label to color picker Mar 13, 2024
@claviska claviska removed this from the 3.0 (future) milestone Mar 13, 2024
@claviska claviska changed the title Add support for label to color picker Add support for label and help text to color picker Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

4 participants