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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: add range thumb slot #1013

wants to merge 4 commits into from

Conversation

luwes
Copy link
Contributor

@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 Nov 6, 2024 9:54pm
media-chrome-demo-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 9:54pm
media-chrome-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 9:54pm

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 138 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
Contributor 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...

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