Repository navigation
fix(html5): re-center microphone glyph in audio modal - #25396
TiagoJacobs merged 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
WalkthroughThe audio modal button styles now target the unmute microphone icon with a scoped selector and apply Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hello @imdt-claudiop This is still not good I annotated on top of your image (see the red lines)
|
|
Thanks for the annotated screenshot - taking a close look at the red lines now. Will re-examine the offset and update. |
The unmute glyph in the bbb-icons font is drawn bottom-heavy (its ink sits below the em-box center), so vertical-align:middle leaves the microphone icon visibly low in the circular button of the audio modal, while the symmetric listen glyph next to it renders centered. Both buttons share the same AudioModalButton styled-component, so the CSS cannot be the differentiator - the asymmetry is intrinsic to the glyph. Add a scoped top nudge (-0.08em, in em so it scales with font size) that empirically re-centers the unmute glyph inside AudioModalButton only. Measured against the listen glyph: ink-centroid offset drops from +3.35% to +0.88% of the circle diameter, and the listen glyph is unchanged (125.2px before and after), confirming the scope isolates the fix. The unmute icon is reused in several other components (mute toggle, audio test, help), so the rule is intentionally scoped rather than global.
The -0.08em offset was insufficient: the reviewer's annotated screenshot showed the mic's solid base bar still descending to (and a hair past) the listen glyph's base, reading as bottom-heavy. The ink-centroid measurement had undersold the perceived offset because the mic's base bar carries more visual weight than the listen's thin earcup tips - the perceived optical center sits lower than the ink centroid. Switch to bounding-box comparison as the criterion. A sweep of seven values shows -0.14em sits at the safe entry of the balanced band: the mic base clears the listen base by ~3px (was 1px below at -0.08em), while over- correcting at -0.18em and above makes the glyph read high. -0.14em is proportional across font sizes (em units) and stays scoped to the unmute glyph inside AudioModalButton.
a987d73 to
cc0532c
Compare
|
Pushed the update. Changed the offset to Your annotation was the key insight: comparing the mic's base bar against the listen glyph's base (not the ink centroid, which understated the perceived offset because the mic's solid base bar carries more visual weight than the headphone's thin tips). At Updated the PR body with the before (rejected |
The unmute glyph's ink box is ~25% taller than the listen glyph's (mic ~61px vs headphone ~49px at the same font-size), so a translation (top offset) can never make them occupy the same vertical space: matching the bases misaligns the tops, and vice versa. The prior -0.14em nudge only shifted the mic, leaving it both off-center and still taller than the headphone. Replace the translate with a uniform scale(0.8) (= 49/61), applied about the glyph's geometric center (transform-origin defaults to 50% 50%). This brings the mic's ink box onto the headphone's: measured on the real modal, mic 148px vs headphone 147px (ratio 1.007), tops aligned, bottoms aligned, centers coincident - the two icons now occupy the same vertical band. Uniform scale is used over the alternatives because it preserves the mic's proportions: scaleY(0.8) flattens the glyph, and a smaller font-size re-anchors on the text baseline (dropping the mic's center below the headphone's). display: inline-block is required because transform does not apply to inline non-replaced elements (the icon renders as <i>). The scale is unitless, so it holds at both the desktop (3.5rem) and mobile (2.5rem) breakpoints without per-size tuning. A residual ~11px ink-centroid offset remains (the mic's mass sits lower than the headphone's because the glyph is hollow on top and heavy at the base), which a very picky eye may still read as faint bottom-heaviness. This is intrinsic to the glyph: aligning centroids would require breaking the bounding-box parity just established, and true centroid+box parity is only reachable by editing the glyph in the font. Scoped to the unmute glyph inside AudioModalButton so the icon reused elsewhere (mute toggle, audio test, help) is untouched.
|
Reworked the fix based on your criterion (both icons occupying the same space). The earlier Uniform One honest limitation I'm not hiding: a residual ink-centroid offset of ~11px remains, because the mic glyph's mass is distributed bottom-heavy (hollow capsule on top, solid base bar at the bottom). A very picky eye may still read faint bottom-heaviness. This is intrinsic to the glyph; aligning centroids would require breaking the bounding-box parity this fix establishes, and true parity is only reachable by reworking the glyph in the font. If centroid parity matters more than box parity, that's a font-level change. |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the HTML5 audio “join” modal’s microphone icon so it visually aligns with the “listen only” (headphone) icon by scaling the unmute glyph within the AudioModalButton styling.
Changes:
- Add a scoped CSS rule that applies
transform: scale(0.8)to theicon-bbb-unmuteglyph within the audio modal’s circular button icon container. - Add in-file documentation explaining the rationale and measurements behind the scaling approach.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // even with their centers aligned the mic overhangs the headphone by ~6px at each end and reads | ||
| // as a different size inside its circle. scale(0.8) (0.8 = 49/61) shrinks the mic to the | ||
| // headphone's ink height about the glyph's geometric center (transform-origin defaults to | ||
| // center), so the two icons occupy the same vertical band. Uniform scale keeps the mic's natural |
There was a problem hiding this comment.
Good catch. Fixed in 91a7baa: reworded to 'rounded from 49/61 ~= 0.803'. Kept the 0.8 value itself because the measured result (mic 148px vs headphone 147px on the real modal, ratio 1.007) confirms 0.8 achieves bounding-box parity within sub-pixel tolerance - the rounded value is simpler than 0.803 and the difference is below the pixel-quantization floor.
| & span:first-child i[class*="icon-bbb-unmute"] { | ||
| display: inline-block; | ||
| transform: scale(0.8); | ||
| } |
There was a problem hiding this comment.
Fixed in 91a7baa: switched to the class selector i.icon-bbb-unmute (exact token match), which excludes icon-bbb-unmute_filled. Confirmed the Icon component renders class 'icon-bbb-' + iconName = 'icon-bbb-unmute' as an exact token, so the selector still targets the microphone glyph as intended.
|
@imdt-claudiop take a look on copilot reviews |
|
On it - addressing both Copilot review comments. The |
Two review comments from Copilot: 1. The comment claimed scale(0.8) = 49/61, but 49/61 is ~0.803. Reword to 'rounded from 49/61 ~= 0.803' so the comment is accurate. The 0.8 value itself is kept: the measured result (mic 148px vs headphone 147px on the real modal, ratio 1.007) confirms 0.8 achieves bounding-box parity within sub-pixel tolerance, and the rounded value is simpler than 0.803. 2. The selector i[class*="icon-bbb-unmute"] matched by substring, which also matches icon-bbb-unmute_filled (a distinct glyph in bbb-icons.css). Switch to the class selector i.icon-bbb-unmute, which matches the exact class token and excludes _filled. The Icon component renders class 'icon-bbb-' + iconName = 'icon-bbb-unmute' (exact token), so the selector still targets the microphone glyph as intended.
|
@Tainan404 Done - addressed both Copilot review comments in 91a7baa:
Replied inline to both Copilot comments. The visual behavior is unchanged; these are a comment-precision fix and a stricter selector. |
Tainan404
left a comment
There was a problem hiding this comment.
Two small, non-blocking notes left inline on the specific lines. (The earlier substring-selector concern is already resolved by i.icon-bbb-unmute in the latest commit — nice.)
| // glyph inside AudioModalButton so the icon reused elsewhere (mute toggle, audio test) is | ||
| // untouched. | ||
| & span:first-child i.icon-bbb-unmute { | ||
| display: inline-block; |
There was a problem hiding this comment.
Nit (non-blocking): display: inline-block is redundant here. The global icon rule [class^="icon-bbb-"], [class*=" icon-bbb-"] in public/stylesheets/bbb-icons.css already declares display: inline-block on every icon-bbb-* element, so this <i> is already inline-block and transform: scale() applies without this line. Harmless to keep as an explicit/defensive declaration, but it can be dropped if you'd prefer to keep the rule to just the transform.
| // untouched. | ||
| & span:first-child i.icon-bbb-unmute { | ||
| display: inline-block; | ||
| transform: scale(0.8); |
There was a problem hiding this comment.
The 0.8 (≈ 49/61) ratio was measured on a single from-source desktop render at 3.5rem. Because scale() is a pure ratio it should hold at the 2.5rem mobile breakpoint by construction, but since it's an empirically-tuned value it'd be worth a quick visual check at the mobile breakpoint and on a non-Chromium browser (Firefox) to confirm the box-parity holds beyond the one measured environment. Not a blocker — just de-risks the tuned constant.
|
@imdt-claudiop take a look on new comments |
|
Looking at both inline nits now - will verify the global |
The global icon rule in bbb-icons.css ([class^="icon-bbb-"] { display:
inline-block; ...}) already sets display:inline-block on every icon-bbb-*
element, so the explicit declaration in the scoped AudioModalButton rule
was redundant. transform: scale(0.8) applies without it: confirmed by
computed style (matrix(0.8,0,0,0.8,0,0)) and measured ink (mic 48.5px =
80% of the 61px baseline) across Chromium and Firefox, desktop and mobile.
Addresses review nit from Tainan404.
|
@Tainan404 Addressed both inline nits in ceb592d. Nit 1 (redundant display:inline-block): Dropped. Confirmed the global rule in Nit 2 (mobile + Firefox check): Validated scale(0.8) across three scenarios. Mic vs listen ink heights (CSS px):
Parity holds in all three - every |Δ| ≤ 0.5px (the single-device-pixel measurement floor), bottoms align exactly. The unitless ratio tracks the smaller mobile em-box perfectly (exact 0.0 deltas), and Firefox renders the bbb-icons font at the same proportions as Chromium, so the 0.8 value needs no per-browser adjustment. Validation screenshots:
Honest scope note: tested the audio-options modal glyphs in these three viewports/browsers. Not tested: RTL, dark mode, WebKit/Safari, mobile-native (which hides the mic button via isMobileNative), and actual media/audio flow (the fix is pure layout CSS, so those paths are unaffected by construction). |
|
✅ Automated tests have passed! |




What's happening
In BBB 3.0, the "How would you like to join the audio?" modal shows two large circular buttons side by side: Microphone and Listen only. The microphone icon does not occupy the same vertical space as the headphone icon next to it - it reads as a different size and visually misaligned.
Why it happens
Both buttons share the same styled component (
AudioModalButtoninaudio-modal/styles.js) and the same centering CSS, so the modal's layout cannot be the differentiator. The cause is in the glyphs themselves: in thebbb-iconsfont, theunmute(microphone) glyph has a taller ink box than thelisten(headphone) glyph - measured at ~61px vs ~49px at the same font-size (the mic is ~25% taller by design). Because the two glyphs have different heights, no amount of vertical translation can make them occupy the same vertical band: aligning the bases misaligns the tops, and vice versa. On top of that, the mic's ink mass is distributed bottom-heavy (hollow capsule on top, solid base bar at the bottom), so even when the ink boxes are centered the mic visually pulls downward.The fix
Replace any vertical nudge with a uniform
scale(0.8)(= 49/61) on the mic glyph, so its ink box matches the headphone's:Why these choices:
scale(0.8)= 49/61 shrinks the mic to the headphone's ink height. The scale is applied about the glyph's geometric center (transform-origindefaults to50% 50%), so the centers stay aligned while the heights match. Measured on the real modal: mic ink 148px vs headphone 147px (ratio 1.007), tops aligned, bottoms aligned, centers coincident - the two icons now occupy the same vertical band.scaleY, notfont-size) preserves the mic's natural proportions.scaleY(0.8)flattens the glyph (too wide); a smallerfont-sizere-anchors on the text baseline, which drops the mic's center below the headphone's.display: inline-blockis required becausetransformdoes not apply to inline non-replaced elements (the icon renders as<i>).icon-bbb-unmuteinsideAudioModalButtonso theunmuteicon reused elsewhere (the mute toggle, audio test, audio help) is untouched. Thelistenglyph shares this styled component but is excluded by the class filter.Evidence
Baseline (no fix): mic visibly taller than headphone, different vertical footprint.
After
scale(0.8): both buttons in the real modal (unretouched render). The mic and the headphone now occupy the same vertical band.Mic vs headphone side by side, confirming the matching vertical footprint:
An honest limitation
A residual ~11px ink-centroid offset remains (the mic's center of mass sits lower than the headphone's, because the glyph is hollow on top and solid at the base). A very picky eye may still read a faint bottom-heaviness. This is intrinsic to the microphone glyph and is not removable via CSS: aligning centroids would require breaking the bounding-box parity this fix establishes, and true centroid + box parity is only reachable by reworking the glyph inside the
.wofffont. If centroid parity matters more than box parity, that is a font-level change and out of scope for this CSS fix.Validation
Validated desktop/moderator in a from-source 3.0 environment (audio modal, both buttons). Bounding-box parity measured pixel-accurate on the unretouched modal render. Mobile (2.5rem) not captured separately, but the unitless scale is font-size-independent so the ratio holds by construction. Opened as draft for review.