fix: keep long text feature values inside the device widget (#2917) - #2919
fix: keep long text feature values inside the device widget (#2917)#2919Pierre-Gilles wants to merge 3 commits into
Conversation
A text device feature carries free-form content published by the device. The Z2M Devices Monitor integration exposes a "Silent device names" feature whose value is a comma-separated list of Zigbee names with no space to break on, so the browser kept it on a single line. The device card table is auto-laid-out, so that one cell held its full one-line width, the table grew past the card and the other feature values were pushed out of the visible area — reproducible as soon as the card is narrow, i.e. in a 3-column dashboard layout. Wrap the text value with overflow-wrap: anywhere, the only value that also lowers the cell's min-content width so the column can shrink back into the card. Fixes #2917
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe device features table and text value renderer now wrap long labels and values within narrow device cards. This prevents long text from causing horizontal overflow. ChangesDevice text wrapping
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This localized front-end change makes long text feature values wrap inside device cards without altering writable controls or server behavior; no actionable merge-blocking risk remains after normal checks and review. Poem
🚥 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 |
Deploying gladys-plus with
|
| Latest commit: |
930020b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5cd67caa.gladys-plus.pages.dev |
| Branch Preview URL: | https://claude-issue-2917.gladys-plus.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2919 +/- ##
=========================================
Coverage 99.51% 99.52%
=========================================
Files 1235 1243 +8
Lines 88064 89642 +1578
=========================================
+ Hits 87638 89216 +1578
Misses 426 426 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🐳 A Docker image has been built for this branch and pushed to the GitHub Container Registry. You can test this pull request (AMD64 only) by pulling the image below: For example, run it with: sudo docker run -d \
--log-driver json-file \
--log-opt max-size=10m \
--cgroupns=host \
--restart=always \
--privileged \
--network=host \
--name gladys-claude-issue-2917 \
-e NODE_ENV=production \
-e SERVER_PORT=80 \
-e TZ=Europe/Paris \
-e SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/gladysassistant:/var/lib/gladysassistant \
-v /dev:/dev \
-v /run/udev:/run/udev:ro \
ghcr.io/gladysassistant/gladys-preview:claude-issue-2917This comment and the image are automatically updated on every new commit pushed to this pull request. Need an ARM64 image (Raspberry Pi, Apple Silicon, …)? Comment |
There was a problem hiding this comment.
Stale comment
Front-only layout fix for #2917. A read-only TEXT feature whose
last_value_stringhas no wrap opportunities (the Z2M Devices Monitor comma-separated name list) inflates the auto-laid-outcard-tablepast the card;.table-responsivethen scrolls and the other feature values look missing in a 3-column dashboard.
overflow-wrap: anywhereon the value container is the right property: unlikebreak-word, it also lowers the cell’s min-content width, which is what lets the column shrink back inside the card. Same idiom asintegrationText.cssand the chart tooltip rule. The CSS-module import (style from '../style.css') matches the rest ofdevice-features/, andoverflow-wrapis inherited by the inner<span>. Scope is correctly limited to the read-only sensor row; the writabletext/selectpath already goes throughAdaptiveOptionControl(#2878).No
constants.js/ device-type changes. Notrisk:high. Notneeds:human-review.Residuals (not blocking)
- Visual confirmation in Firefox at 3 columns is still needed — the author already listed this;
.table-vcenteronly setsvertical-align, so it should not fight the wrap.- A very long list will grow the row vertically instead of truncating. That is a product follow-up, not a defect in this fix.
overflow-wrap: anywhereis ignored on Safari < 15.4 (the JS bundle still targets Safari 13 for wall tablets). Other call sites already accept that;browserslistdefaultscovers current Safari.Sent by Cursor Automation: Automatic PR review
There was a problem hiding this comment.
Stale comment
Cannot approve: this SHA does not fix the overflow.
Pierre-Gilles tested the branch with many devices and still sees values clipped off the right of the card. The screenshots match that:
Pas de valeur récentebadges and toggles are cut off, while a TEXT value that already has spaces wraps. So the remaining overflow is not the no-space TEXT cell this PR targets.
overflow-wrap: anywhereonTextDeviceValueis the right property for a comma-separated list (and should be kept), but the device widget is an auto-layouttable.card-tableinside.table-responsive. Feature names, Tabler nowrap badges, sliders and switches all contribute min-content; once that exceeds the 3-column card, the wrapper scrolls and sibling values look missing — the #2917 symptom. Wrapping one inner<div>cannot stop that, and on Firefox (the original report)anywhereon a table-cell descendant often does not shrink auto-layout min-content anyway.Please constrain the table itself (
table-layout: fixed; width: 100%on the device-card table, wrap on name cells, allow the no-recent-value badge to wrap) and re-check a 3-column dashboard. Until the card no longer scrolls horizontally, this should not merge.No
constants.js/ device-type changes. Notrisk:high. Notneeds:human-review— this is an incomplete layout fix, not a philosophy question.Sent by Cursor Automation: Automatic PR review
Wrapping the TEXT value alone did not fix #2917: the card renders its features in an auto-laid-out table inside .table-responsive, and an auto table can never be narrower than the sum of its columns' min-content widths. Several cells set a floor on that sum, so the wrapper kept scrolling horizontally and the values on the right stayed out of sight even on a branch where the TEXT value already wrapped. Remove the two floors that dominate it: - the feature name cell, which a long label such as "Compteur électrique index - Consommation 30 minutes" holds open, now uses overflow-wrap: anywhere, the only value that also lowers the cell's min-content width; - Tabler renders sensor value badges with white-space: nowrap, so "Pas de valeur récente" counted as one unbreakable word and reserved its full width; letting it wrap drops that floor to its longest word. Both rules are scoped to the device card table, so no other card-table in the app is affected. Column sizing is unchanged whenever the card is wide enough; only the point at which the table can no longer shrink moves. Autofix-Pass: 1
There was a problem hiding this comment.
Stale comment
5e24966addresses the overflow Pierre reproduced on the first SHA. Wrapping only.textValueleft the autocard-tableheld open by two other min-content floors: the name cell (td:nth-child(2)/rowNameon all 26 row types) and Tabler’s.badge { white-space: nowrap }(Pas de valeur récente). Both now wrap, scoped todeviceFeaturesTable.:global(.badge)is the right CSS-modules escape so Tabler’s class is not hashed.Skipping
table-layout: fixed; width: 100%is the right call. With no column widths, fixed layout would give the icon column a third of the card, and.setpointHorizontalControls { min-width: 7rem }would overflow the cell instead of the table. Lowering the auto-table floors keeps wide-card column sizing unchanged.
.textValue { overflow-wrap: anywhere }stays as the no-space TEXT (Z2M Silent device names) piece. Noconstants.js/ device-type changes. Notrisk:high. Notneeds:human-review.Residuals (not blocking)
- Apply
overflow-wrap: anywhereto everytd(not onlynth-child(2)) if Firefox still overflows on a no-space TEXT value: wrap currently sits on the inner.textValuediv for the value column, and some Firefox auto-table paths ignore descendantanywherewhen computing min-content. The name column already has it on thetditself.- A 3-column check in Firefox is still the visual confirmation this PR asks for.
- A very long list still grows the row vertically. Product follow-up, not a defect.
Sent by Cursor Automation: Automatic PR review
The previous pass lifted the min-content floor off the feature name cell only (td:nth-child(2)). The value column still relied on overflow-wrap sitting on the inner .textValue div, and that is exactly the #2917 case: a comma-separated list of Zigbee device names is one unbreakable token, and Firefox — the browser in the report — frequently keeps an auto table's min-content width unchanged when the property is set on a descendant of the cell rather than on the cell itself. Widen the selector to .deviceFeaturesTable td so the constraint applies to the cell in every column. The icon cell holds a lone <i> and the colour picker row is a single colspan cell, so neither changes; controls keep their own min-width, which overflow-wrap does not touch. Autofix-Pass: 2
There was a problem hiding this comment.
930020b addresses the last residual from the previous pass. Wrapping only td:nth-child(2) left the value column depending on overflow-wrap on the inner .textValue div — the descendant-of-a-cell case Firefox often ignores when computing auto-table min-content, and exactly the #2917 value (a comma-separated Zigbee name list with no spaces). The selector is now .deviceFeaturesTable td, so every cell, including the value column, can shrink.
The rest of 5e24966 still stands: name cells wrap, Tabler .badge { white-space: nowrap } is lifted via :global(.badge) so Pas de valeur récente is no longer an unbreakable floor, and skipping table-layout: fixed remains the right call (equal columns would give the icon a third of the card; .setpointHorizontalControls { min-width: 7rem } would then overflow the cell). .textValue is now redundant with the cell rule; harmless.
No constants.js / device-type changes. Not risk:high. Not needs:human-review.
Residuals (not blocking)
- A 3-column check in Firefox is still the visual confirmation this PR asks for — no browser in this environment, and this SHA has not yet been eye-verified.
- A very long list still grows the row vertically. Product follow-up, not a defect.
- Controls that set their own min-width (setpoints, sliders, switches) still floor the value column; that is pre-existing and unchanged.
Sent by Cursor Automation: Automatic PR review




Fixes #2917
Description
What changed and why
A text device feature (
DEVICE_FEATURE_CATEGORIES.TEXT) carries free-form content that the device decides. The Z2M Devices Monitor integration publishes a Silent device names feature whose value is a comma-separated list of Zigbee device names — a string with no space to break on, so the browser keeps it on a single line.The device widget renders its features in a
table card-tableinside a.table-responsivewrapper, with automatic table layout. A cell whose content cannot wrap keeps its full one-line width, so the table grows past the card and.table-responsivestarts scrolling horizontally: the values of the other features end up outside the visible area and look missing. The narrower the card, the sooner it happens — a 3-column dashboard layout is enough, while a 2-column one is still wide enough to fit the value, which matches exactly what the reporter observed (and why removing the text feature made the other values come back).The fix wraps the text value with
overflow-wrap: anywhere.anywhereis deliberate rather thanbreak-word: it is the value that also lowers the cell's min-content width, which is what lets the column shrink back inside the card.break-wordwraps visually but leaves the intrinsic width untouched, so the table would still overflow. This is the same idiom already used in the codebase for external-integration texts (front/src/routes/integration/all/external-integration/integrationText.css) and for the chart tooltips (front/src/style/index.css).Two files touched:
front/src/components/boxs/device-in-room/device-features/style.css— new.textValueclass (with a comment explaining theanywherevsbreak-wordchoice).front/src/components/boxs/device-in-room/device-features/sensor-value/TextDeviceValue.jsx— applies the class to the value container.Scope is intentionally limited to the read-only text sensor value. The writable
text/selectfeature already goes throughAdaptiveOptionControl, which was made narrow-card aware in #2878, and is untouched here.Forum
Community discussion: https://community.gladysassistant.com/t/probleme-affichage-integration-externe-z2m-devices-monitor/10627/7
What I verified locally (in
front/, with real dependencies installed)npm run prettier-check→ All matched files use Prettier code style! (prettier 1.19.1, the pinned version; only the file I touched was formatted)npm run eslint→ 0 errors (196 pre-existing warnings, none in the changed files)npm run compare-translations→ No errors foundnpm run build→ built successfully; confirmed the generated CSS bundle containstextValue{overflow-wrap:anywhere}and that the JS bundle references the class, so the CSS-module wiring is correctWhat a human must check before merge
This is a CSS/layout fix and it was not visually confirmed — Cypress could not run in the sandbox (the binary download fails) and no browser was available. Please confirm by eye:
text-right) look of the wrapped value is acceptable — a wrapped value is ragged on the left.overflow-wrap: anywhereaffecting intrinsic sizing is the load-bearing behaviour here.Checklist
npm run eslint,npm run prettier)Generated by Claude Code
Summary by CodeRabbit