Skip to content

fix: add inline-flex alignment to slot[name=icon] for proper SVG centering in buttons#1295

Merged
ronald-urbina merged 4 commits into
muxinc:mainfrom
n3crosis:copilot/fix-nested-slot-alignment
May 28, 2026
Merged

fix: add inline-flex alignment to slot[name=icon] for proper SVG centering in buttons#1295
ronald-urbina merged 4 commits into
muxinc:mainfrom
n3crosis:copilot/fix-nested-slot-alignment

Conversation

@n3crosis

@n3crosis n3crosis commented May 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #1294

Nested <slot> elements in button components are inline by default, so vertical-align: middle on SVGs resolves against font baseline metrics rather than the control center. This causes icons to visually drift toward the bottom of the button.

Changes

  • add display: inline-flex and align-items: center to slot[name="icon"] in src/js/media-chrome-button.ts
  • mirror the slot alignment approach already used in src/js/menu/media-chrome-menu-item.ts

Affected buttons

  • media-play-button
  • media-mute-button
  • media-fullscreen-button
  • media-pip-button
  • media-cast-button
  • media-airplay-button
  • media-captions-button

Note

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 with inline-flex and align-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-button template 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.

… 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 AI review requested due to automatic review settings May 25, 2026 16:25
@n3crosis n3crosis requested review from a team and heff as code owners May 25, 2026 16:25
@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@snyk-io

snyk-io Bot commented May 25, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 icon named slot as an inline-flex container.
  • Vertically center assigned icon content via align-items: center.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel

vercel Bot commented May 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
media-chrome Ready Ready Preview, Comment May 28, 2026 6:47pm
media-chrome-demo-nextjs Ready Ready Preview, Comment May 28, 2026 6:47pm
media-chrome-docs Ready Ready Preview, Comment May 28, 2026 6:47pm

Request Review

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.64%. Comparing base (3ea80df) to head (1be32de).
⚠️ Report is 314 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ronald-urbina ronald-urbina merged commit 7e0869a into muxinc:main May 28, 2026
11 of 12 checks passed
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.

Buttons with nested icon slots render SVGs slightly too low

4 participants