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

feat: add range thumb slot #1013

Merged
merged 4 commits into from
Feb 13, 2025
Merged

feat: add range thumb slot #1013

merged 4 commits into from
Feb 13, 2025

Conversation

luwes
Copy link
Collaborator

@luwes luwes commented Oct 24, 2024

adds a thumb slot for range elements.

this is required for some CSS features like animations because the declared keyframes have to be in the same scope as the element to which they are applied.

@luwes luwes self-assigned this Oct 24, 2024
@luwes luwes requested review from heff and a team as code owners October 24, 2024 22:09
Copy link

vercel bot commented Oct 24, 2024

@luwes is attempting to deploy a commit to the Mux Team on Vercel.

A member of the Team first needs to authorize it.

@luwes luwes changed the title feat: add thumb slot feat: add range thumb slot Oct 24, 2024
Copy link

vercel bot commented Oct 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
media-chrome ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 7:22pm
media-chrome-demo-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 7:22pm
media-chrome-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 7:22pm

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.00%. Comparing base (3ea80df) to head (ed6e25c).
Report is 156 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1013      +/-   ##
==========================================
- Coverage   78.55%   77.00%   -1.56%     
==========================================
  Files          59       50       -9     
  Lines       11080    12132    +1052     
  Branches        0      705     +705     
==========================================
+ Hits         8704     9342     +638     
- Misses       2376     2764     +388     
- Partials        0       26      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -172,14 +172,11 @@ template.innerHTML = /*html*/ `
}
}

#thumb {
#thumb,
::slotted([slot=thumb]) {
width: var(--media-range-thumb-width, 10px);
height: var(--media-range-thumb-height, 10px);
margin-left: calc(var(--media-range-thumb-width, 10px) / -2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to keep height/width in here because of this placement math, but that feels like it'll be annoying. Is there any other CSS magic we could use where the margin could be based off whatever width the thumb happens to be?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this worked via a CSS translate (or transform) with -50% since it's relative to itself. not to the parent like position absolute...

Copy link
Collaborator

@heff heff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to merge to me.

@luwes luwes merged commit beb0955 into muxinc:main Feb 13, 2025
6 of 8 checks passed
@luwes luwes deleted the thumb-slot branch February 13, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants