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

active-base part for tabs #885

Closed
arackaf opened this issue Aug 29, 2022 · 5 comments
Closed

active-base part for tabs #885

arackaf opened this issue Aug 29, 2022 · 5 comments
Assignees
Labels
feature Feature requests.

Comments

@arackaf
Copy link

arackaf commented Aug 29, 2022

What issue are you having?

I've like to change the cursor of tab headers which are active

Describe the solution you'd like

Tab headers already have a part of base, but it turns out you cannot chain class selectors onto part selectors, so

::part(base).tab.tab--active

does nothing.

w3c/csswg-drafts#3431

BUT you can have more than one part on an element. Would it be possible to get something like active-base be added to the tab header which is currently active? That would allow users to target it, without also targeting non-active tabs.

So basically, whatever code is toggling the .tab--active class, would also toggle a new active-base part.

Describe alternatives you've considered

I'd like to just select off of css classes you already have, but that's not possible. For good reasons, admittedly. Those css classes are an implementation detail.

@arackaf arackaf added the feature Feature requests. label Aug 29, 2022
@bunesk
Copy link
Contributor

bunesk commented Aug 29, 2022

I guess using sl-tab[active]::part(base) instead should already work.

@arackaf
Copy link
Author

arackaf commented Aug 29, 2022

@Buni48

Oof - this was painful. Never mind - sorry to waste anyone's time. This is obviously the right way to do this.

@arackaf arackaf closed this as completed Aug 29, 2022
@qbunt
Copy link

qbunt commented Feb 12, 2024

@bunesk found this because I was having issues with the same and this:

I guess using sl-tab[active]::part(base) instead should already work.

no longer works. Anyone have any ideas how I can target only the active state? I've tried just about everything I can throw at it.

@bunesk
Copy link
Contributor

bunesk commented Feb 12, 2024

@qbunt I tried it again with the current shoelace version and it seems to work fine. See here:
https://codepen.io/bunesk/pen/eYXQgWg

@qbunt
Copy link

qbunt commented Feb 13, 2024

@bunesk I thought this wasn't working because of usage inside tab-group, but it is working fine, my issue was a misplaced custom property. Thanks, this helped a ton! 🍻.

It's probably worth mentioning this syntax in the docs, I'm a newcomer to Shoelace and it was almost impossible to find if it wasn't for this issue, I'll put together a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature requests.
Projects
None yet
Development

No branches or pull requests

4 participants