Skip to content

fix: keep long text feature values inside the device widget (#2917) - #2919

Open
Pierre-Gilles wants to merge 3 commits into
masterfrom
claude/issue-2917
Open

fix: keep long text feature values inside the device widget (#2917)#2919
Pierre-Gilles wants to merge 3 commits into
masterfrom
claude/issue-2917

Conversation

@Pierre-Gilles

@Pierre-Gilles Pierre-Gilles commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

⚠️ This pull request was produced by an automated routine and has NOT been reviewed by a human. Please review the diff carefully — in particular the visual checks listed at the bottom — before merging.

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-table inside a .table-responsive wrapper, 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-responsive starts 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. anywhere is deliberate rather than break-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-word wraps 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 .textValue class (with a comment explaining the anywhere vs break-word choice).
  • 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/select feature already goes through AdaptiveOptionControl, 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-checkAll matched files use Prettier code style! (prettier 1.19.1, the pinned version; only the file I touched was formatted)
  • npm run eslint0 errors (196 pre-existing warnings, none in the changed files)
  • npm run compare-translationsNo errors found
  • npm run build → built successfully; confirmed the generated CSS bundle contains textValue{overflow-wrap:anywhere} and that the JS bundle references the class, so the CSS-module wiring is correct
  • No server code changed, so no server test suite was run.

What 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:

  1. A device widget containing a text feature with a long value (e.g. the Z2M Devices Monitor Silent device names feature, or any long comma-separated string with no spaces) in a 3-column dashboard layout: the value now wraps onto several lines, the card no longer scrolls horizontally, and the icon / label / value of the other features are all visible again.
  2. The same widget in 2-column and 1-column / mobile layouts, to confirm nothing regressed where it already worked.
  3. That the right-aligned (text-right) look of the wrapped value is acceptable — a wrapped value is ragged on the left.
  4. That a very long list (many dozens of names) produces an acceptably tall row. This PR makes the value wrap rather than truncate, so the widget grows vertically instead of overflowing horizontally. If the project would rather clamp or scroll that content, that is a follow-up design decision, not something this fix takes.
  5. Firefox specifically (the browser in the report) as well as a Chromium-based browser — overflow-wrap: anywhere affecting intrinsic sizing is the load-bearing behaviour here.

Checklist

  • Linter and prettier pass on front (npm run eslint, npm run prettier)
  • No undocumented breaking change
  • Cypress not run (unavailable in the sandbox) — see the manual visual checks above

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved display of long text values in device cards.
    • Text now wraps within available space, preventing content from forcing cards or tables beyond their layout.
    • Device feature tables now adapt better to narrow cards.
    • Sensor value badges can wrap normally, reducing horizontal overflow.

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
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b347eff-ba1e-4332-84f9-f8a94b7ad699

📥 Commits

Reviewing files that changed from the base of the PR and between 5e24966 and 930020b.

📒 Files selected for processing (1)
  • front/src/components/boxs/device-in-room/style.css
🚧 Files skipped from review as they are similar to previous changes (1)
  • front/src/components/boxs/device-in-room/style.css

Included review availability: Your plan includes up to 8 reviews per rolling hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The 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.

Changes

Device text wrapping

Layer / File(s) Summary
Responsive device feature layout
front/src/components/boxs/device-in-room/DeviceCard.jsx, front/src/components/boxs/device-in-room/style.css, front/src/components/boxs/device-in-room/device-features/sensor-value/TextDeviceValue.jsx, front/src/components/boxs/device-in-room/device-features/style.css
The device features table uses style.deviceFeaturesTable. Table cells and sensor value badges can wrap. Text values use style.textValue with overflow-wrap: anywhere.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 93002

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

A rabbit wraps each value tight,
Long names stay within the light.
No card expands, no words escape,
Each feature keeps its proper shape. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: keeping long text feature values inside device widgets.
Linked Issues check ✅ Passed The changes add wrapping and table-cell sizing constraints that address issue #2917 and keep long feature values within narrow widgets.
Out of Scope Changes check ✅ Passed All changes are limited to device feature value wrapping and responsive table sizing required by issue #2917.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-2917

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploying gladys-plus with  Cloudflare Pages  Cloudflare Pages

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

View logs

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.52%. Comparing base (a40d19f) to head (930020b).
⚠️ Report is 20 commits behind head on master.

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.
📢 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.

@github-actions

Copy link
Copy Markdown
Contributor

🐳 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:

ghcr.io/gladysassistant/gladys-preview:claude-issue-2917

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-2917

This 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 /build-arm64 on this pull request.

cursor[bot]
cursor Bot previously approved these changes Aug 17, 2026

@cursor cursor Bot 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.

Stale comment

Front-only layout fix for #2917. A read-only TEXT feature whose last_value_string has no wrap opportunities (the Z2M Devices Monitor comma-separated name list) inflates the auto-laid-out card-table past the card; .table-responsive then scrolls and the other feature values look missing in a 3-column dashboard.

overflow-wrap: anywhere on the value container is the right property: unlike break-word, it also lowers the cell’s min-content width, which is what lets the column shrink back inside the card. Same idiom as integrationText.css and the chart tooltip rule. The CSS-module import (style from '../style.css') matches the rest of device-features/, and overflow-wrap is inherited by the inner <span>. Scope is correctly limited to the read-only sensor row; the writable text/select path already goes through AdaptiveOptionControl (#2878).

No constants.js / device-type changes. Not risk:high. Not needs:human-review.

Residuals (not blocking)

  • Visual confirmation in Firefox at 3 columns is still needed — the author already listed this; .table-vcenter only sets vertical-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: anywhere is ignored on Safari < 15.4 (the JS bundle still targets Safari 13 for wall tablets). Other call sites already accept that; browserslist defaults covers current Safari.
Open in Web View Automation 

Sent by Cursor Automation: Automatic PR review

@Pierre-Gilles Pierre-Gilles left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've tested with many devices, and I've still got the problem

Image Image

I'm not sure it's related to the text feature, I think it's another feature type, or related to the length of device feature names

@Pierre-Gilles
Pierre-Gilles dismissed cursor[bot]’s stale review August 17, 2026 07:31

Fix is not working

@Pierre-Gilles Pierre-Gilles added the needs:cursor-review Automated review by Cursor is needed label Aug 17, 2026 — with Cursor

@cursor cursor Bot 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.

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écente badges 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: anywhere on TextDeviceValue is the right property for a comma-separated list (and should be kept), but the device widget is an auto-layout table.card-table inside .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) anywhere on 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. Not risk:high. Not needs:human-review — this is an incomplete layout fix, not a philosophy question.

Open in Web View Automation 

Sent by Cursor Automation: Automatic PR review

Comment thread front/src/components/boxs/device-in-room/device-features/style.css
@Pierre-Gilles Pierre-Gilles removed the needs:cursor-review Automated review by Cursor is needed label Aug 17, 2026
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
cursor[bot]
cursor Bot previously approved these changes Aug 18, 2026

@cursor cursor Bot 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.

Stale comment

5e24966 addresses the overflow Pierre reproduced on the first SHA. Wrapping only .textValue left the auto card-table held open by two other min-content floors: the name cell (td:nth-child(2) / rowName on all 26 row types) and Tabler’s .badge { white-space: nowrap } (Pas de valeur récente). Both now wrap, scoped to deviceFeaturesTable. :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. No constants.js / device-type changes. Not risk:high. Not needs:human-review.

Residuals (not blocking)

  • Apply overflow-wrap: anywhere to every td (not only nth-child(2)) if Firefox still overflows on a no-space TEXT value: wrap currently sits on the inner .textValue div for the value column, and some Firefox auto-table paths ignore descendant anywhere when computing min-content. The name column already has it on the td itself.
  • 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.
Open in Web View Automation 

Sent by Cursor Automation: Automatic PR review

Comment thread front/src/components/boxs/device-in-room/style.css Outdated
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

@cursor cursor Bot 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.

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.
Open in Web View Automation 

Sent by Cursor Automation: Automatic PR review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:front Preact front-end type:fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long text value breaks device widget in a 3-column dashboard layout

2 participants