fix: add inline-flex alignment to slot[name=icon] for proper SVG centering in buttons#1295
Conversation
… centering in buttons The nested slot elements in button components (play, mute, fullscreen, etc.) are inline by default, causing SVG icons to drift to the bottom due to inline baseline math with vertical-align: middle. Adding display: inline-flex and align-items: center to slot[name="icon"] ensures proper vertical centering, mirroring the fix applied to menu items in commit 3518818.
|
@Copilot is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds styling to improve vertical alignment of custom slotted icons in media-chrome-button.
Changes:
- Style the
iconnamed slot as aninline-flexcontainer. - Vertically center assigned icon content via
align-items: center.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ertical alignment issues" This reverts commit 73d4994.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1295 +/- ##
==========================================
- Coverage 78.55% 73.64% -4.91%
==========================================
Files 59 56 -3
Lines 11080 13903 +2823
Branches 0 787 +787
==========================================
+ Hits 8704 10239 +1535
- Misses 2376 3631 +1255
- Partials 0 33 +33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #1294
Nested
<slot>elements in button components are inline by default, sovertical-align: middleon SVGs resolves against font baseline metrics rather than the control center. This causes icons to visually drift toward the bottom of the button.Changes
display: inline-flexandalign-items: centertoslot[name="icon"]insrc/js/media-chrome-button.tssrc/js/menu/media-chrome-menu-item.tsAffected buttons
media-play-buttonmedia-mute-buttonmedia-fullscreen-buttonmedia-pip-buttonmedia-cast-buttonmedia-airplay-buttonmedia-captions-buttonNote
Low Risk
Presentation-only CSS on the shared button component with no logic or API changes.
Overview
Fixes icon vertical alignment in shared media-chrome button chrome by styling the
slot[name="icon"]wrapper withinline-flexandalign-items: center, so slotted SVGs/icons center in the control instead of sitting low against the text baseline.This is a small CSS-only change on the base
media-chrome-buttontemplate and applies across play, mute, fullscreen, PiP, cast, airplay, captions, and related controls that use the icon slot.Reviewed by Cursor Bugbot for commit 1be32de. Bugbot is set up for automated code reviews on this repo. Configure here.