Repository navigation
syslog: keep severity-legend chips equal width using the longest label - #389
Merged
Merged
Conversation
The System Logs and Alert Logs severity legends used flex:1 1 0 with no shared minimum, so chips grew to unequal widths (and could clip their labels when tight). CSS can't measure the widest sibling, so syslog_syslog_legend() and syslog_log_legend() now build their severities as an ordered array, compute the longest label, and emit it as a --syslog-chip-min CSS variable (calc(<longest>ch + 1.5rem)); every stylesheet (per-theme + the legend.css fallback) uses it as a shared min-width (falling back to max-content). All chips share one minimum, so they stay equal width as the legend wraps. Updated SyslogLegendTest assertions to match the new container markup; the translatable string set is unchanged.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Flex wrapping still produces unequal final-row widths, and character counts do not reliably represent rendered label widths.
Review effort: Balanced
Findings: 11
Open (11)
Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Prevent flex growth from creating unequal wrapped legend items · New Use rendered widths instead of character counts for label sizing · New Assert the expected computed minimum for label sizing · New
What changed in this PR
Updates severity legends to derive a shared chip minimum width from the longest label.
Changes:
- Computes and emits
--syslog-chip-min. - Applies the minimum across all theme stylesheets.
- Updates tests and changelog documentation.
| File | Description |
|---|---|
includes/functions.php |
Computes shared legend sizing. |
tests/Unit/SyslogLegendTest.php |
Updates legend markup assertions. |
css/classic.css |
Applies shared minimum width. |
css/dark.css |
Applies shared minimum width. |
css/deepness.css |
Applies shared minimum width. |
css/legend.css |
Updates fallback legend styling. |
css/midwinter.css |
Applies shared minimum width. |
css/modern.css |
Applies shared minimum width. |
css/paper-plane.css |
Applies shared minimum width. |
css/paw.css |
Applies shared minimum width. |
css/sunrise.css |
Applies shared minimum width. |
CHANGELOG.md |
Documents the legend refinement. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
xmacan
approved these changes
Oct 7, 2026
xmacan
approved these changes
Oct 7, 2026
xmacan
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Makes the System Logs and Alert Logs severity-legend chips stay equal width as the legend wraps responsively — the same refinement already applied to the Monitor and Thold plugins.
With
flex: 1 1 0and no shared minimum, each chip's floor was effectively its own text width, so the chips grew to different widths (and could clip their labels when space was tight). CSS can't measure the widest sibling, sosyslog_syslog_legend()andsyslog_log_legend()now build their severities as an ordered array, compute the longest label, and emit it as a--syslog-chip-minCSS variable (calc(<longest>ch + 1.5rem)). Every stylesheet — each per-themecss/<theme>.cssand thecss/legend.cssfallback — uses that as a sharedmin-width(falling back tomax-content).Because every chip shares the same minimum, the equal
flex-growresolves them to equal widths, and they wrap as a tidy grid.white-space: nowrapis retained, so labels never clip.Related Issue
Follow-up to the severity-legend chip restyle already on
develop.Motivation and Context
Keeps each severity legend reading as a clean, uniform key rather than a row of mismatched chip widths, especially once it wraps.
How Has This Been Tested?
php -lclean onincludes/functions.phpandtests/Unit/SyslogLegendTest.php.legend.css) remain brace-balanced.SyslogLegendTestassertions updated to match the new container markup; both renderers stay covered by the existing tests, satisfying the patch-coverage gate. The set of translatable strings is unchanged (same__()calls, just reorganised into an array), so nocacti.potupdate is required.Types of changes
Checklist: