fix(deckgl): render legend swatch as a coloured box, not an emoji glyph#40784
fix(deckgl): render legend swatch as a coloured box, not an emoji glyph#40784FullStackChef wants to merge 2 commits into
Conversation
Code Review Agent Run #c86eefActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
7a58387 to
42367af
Compare
The deck.gl chart legend drew each category swatch as the Unicode glyph U+25FC / U+25FB tinted via the CSS `color` property. Those code points are in Unicode's Emoji set but lack Emoji_Presentation, so Chromium resolves them to a colour-emoji font (Noto Color Emoji / Segoe UI Emoji / Apple Color Emoji) whose glyphs carry baked-in colour and ignore `color` - the swatch renders as a black square regardless of the category colour. Firefox uses a monochrome text glyph that honours `color`, so it was unaffected. Replace the colour-tinted glyph with a real bordered box whose background-color is the category colour (filled when enabled, hollow when disabled), centred in the flex row via align-self. A box renders nothing through the font layer, so it is immune to emoji-font presentation. Also removes a stray leftover className="dupa" on the legend container. Affects the Polygon, Scatterplot, Arc and Path charts, which share this component. Fixes apache#40783 Signed-off-by: Brett Smith <brett@pukekos.co.nz>
Code Review Agent Run #d13269Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
@FullStackChef would you mind putting before and after screenshots into your PR summary? |
There was a problem hiding this comment.
Pull request overview
This PR fixes deck.gl categorical chart legend swatches rendering as black squares in Chromium-based browsers by replacing the Unicode square glyph (affected by emoji-font rendering that ignores CSS color) with a real <span> box whose background-color/border reflect the category color. It also removes an unintended leftover className="dupa" on the legend container.
Changes:
- Replace legend swatch glyph rendering with a bordered
<span>box (filled when enabled, hollow when disabled). - Remove stray
className="dupa"from the legend container.
| const categories = Object.entries(categoriesObject).map(([k, v]) => { | ||
| const style = { color: `rgba(${v.color?.join(', ')})` }; | ||
| const icon = v.enabled ? '\u25FC' : '\u25FB'; | ||
| const color = `rgba(${v.color?.join(', ')})`; |
|
The suggestion to convert the alpha component of the color array from a 0–255 range to a 0–1 range for the CSS superset-frontend/plugins/preset-chart-deckgl/src/components/Legend.tsx |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40784 +/- ##
=======================================
Coverage 64.06% 64.06%
=======================================
Files 2664 2664
Lines 143922 143923 +1
Branches 33096 33096
=======================================
+ Hits 92204 92205 +1
Misses 50108 50108
Partials 1610 1610
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

SUMMARY
Fixes #40783.
The deck.gl chart legend rendered each category colour swatch as the Unicode
glyph
◼(U+25FC) /◻(U+25FB) tinted only via the CSScolorproperty.Those code points are in Unicode's Emoji set but lack
Emoji_Presentation, soChromium-based browsers (Chrome/Edge/Chromium) resolve them to a colour-emoji
font (Noto Color Emoji / Segoe UI Emoji / Apple Color Emoji). Emoji glyphs
carry baked-in colour and ignore CSS
color, so the swatch renders as ablack square regardless of the category colour. Firefox uses a monochrome
text glyph that honours
color, which is why it was unaffected. (Fulldiagnosis by @alex-poor in #40783.)
This replaces the colour-tinted glyph with a real bordered
<span>box whosebackground-coloris the category colour — filled when the category isenabled, hollow (border only) when disabled. A box renders nothing through the
font layer, so it is immune to emoji-font presentation and always reflects the
category colour. Interactions (toggle / double-click) are unchanged.
The component is shared by the Polygon, Scatterplot, Arc and Path deck.gl
charts, so all four are fixed by this change.
It also removes a stray leftover
className="dupa"on the legend container(introduced inadvertently in the #24933 TS conversion; no CSS targets it).
BEFORE/AFTER
Before (Chromium): a black square for every category — see the screenshots

in #40783.
After: each swatch shows its category colour, matching the map

TESTING INSTRUCTIONS
font installed (default on Windows/macOS/most Linux desktops).
categorical colour so the legend shows category swatches.
colour. Previously it was a black square.
ADDITIONAL INFORMATION