Skip to content

Fix long label overflow in the device state change scene trigger - #2943

Merged
Pierre-Gilles merged 2 commits into
masterfrom
claude/device-state-trigger-button-text
Aug 21, 2026
Merged

Fix long label overflow in the device state change scene trigger#2943
Pierre-Gilles merged 2 commits into
masterfrom
claude/device-state-trigger-button-text

Conversation

@Pierre-Gilles

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

Copy link
Copy Markdown
Contributor

Implements feature request: https://community.gladysassistant.com/t/pb-sur-affichage-changement-detat-de-lappareil/10590

Description

In the scene editor, the "device state change" trigger lets you pick the target state with two buttons. For a motion sensor the labels are Mouvement détecté / Pas de mouvement, and they did not fit in the buttons: the text was cut off (see the screenshot in the forum topic).

Cause: the theme ships white-space: nowrap on .btn. The state buttons live in a col-6 inside a col-md-5 column, so they have a fairly narrow fixed width. Since the label could not wrap, any label longer than that width overflowed the button and got clipped.

Fix (CSS only): a shared deviceStateButton class in front/src/routes/scene/edit-scene/triggers/style.css that:

  • sets white-space: normal (plus overflow-wrap: anywhere for a single very long word) so the label wraps on several lines instead of overflowing,
  • stretches the button to the height of its column (d-flex on the column + flex: 1 / height: 100% on the button) so the two buttons stay the same height and aligned when only one of them wraps.

The class is applied to the three state widgets of this trigger that render such buttons: BinaryDeviceState (the one from the report), PresenceSensorDeviceState and DoorbellRingDeviceState — the last two show Si l'appareil est détecté / Sonnette actionnée, which have the same problem on narrow screens.

The French translations were deliberately not shortened: the fix is on the layout, so it holds for every language and for any current or future feature type with long value labels. No translation key was added or changed. The change is front-only and does not touch any behavior.

Checked at desktop and mobile widths: on xs the buttons take half of the full row width, on md+ they wrap onto two lines and stay aligned.

Forum

Forum: https://community.gladysassistant.com/t/pb-sur-affichage-changement-detat-de-lappareil/10590

Checklist

  • Tests pass: cd server && npm run coverage (Codecov requires 100% coverage on changed lines) and Cypress (npm run cypress:run) if the UI changed
  • Linter and prettier pass on both front and server (npm run eslint, npm run prettier)
  • No undocumented breaking change

Front checks run locally: npm run prettier, npm run prettier-check, npm run eslint (0 errors), npm run compare-translations (no errors), npm run build (success). server/ was not modified, so the server test suite was not run. Cypress was not run locally because the Cypress binary is not installed in this environment — CI will run it.

This pull request was created by an automated Claude Code run.


🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • Style
    • Improved device state trigger button layout and alignment.
    • Long button labels now wrap correctly.
    • Paired buttons consistently fill their available column height.
    • Updated doorbell and presence sensor trigger controls for a more consistent appearance.

The theme sets `white-space: nowrap` on `.btn`, so the state buttons of the
"device state change" trigger could not wrap. With their fixed column width,
long labels such as the motion sensor ones ("Mouvement détecté" / "Pas de
mouvement") overflowed the button and were cut off.

Add a shared `deviceStateButton` class that lets the label wrap on several
lines and stretches the button to the height of its column, so a pair of
buttons stays aligned when only one of them wraps. Applied to the binary,
presence sensor and doorbell state widgets, which all render such buttons.

This is a CSS-only fix, so it works for any language and any feature type.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added area:front Preact front-end type:fix Bug fix labels Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 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: a13685a7-7b37-48c2-a6aa-92da8dc30040

📥 Commits

Reviewing files that changed from the base of the PR and between ef4c6f7 and 700eb43.

📒 Files selected for processing (4)
  • front/src/routes/scene/edit-scene/triggers/device-states/BinaryDeviceState.jsx
  • front/src/routes/scene/edit-scene/triggers/device-states/DoorbellRingDeviceState.jsx
  • front/src/routes/scene/edit-scene/triggers/device-states/PresenceSensorDeviceState.jsx
  • front/src/routes/scene/edit-scene/triggers/style.css
🚧 Files skipped from review as they are similar to previous changes (4)
  • front/src/routes/scene/edit-scene/triggers/device-states/PresenceSensorDeviceState.jsx
  • front/src/routes/scene/edit-scene/triggers/device-states/BinaryDeviceState.jsx
  • front/src/routes/scene/edit-scene/triggers/device-states/DoorbellRingDeviceState.jsx
  • front/src/routes/scene/edit-scene/triggers/style.css

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


📝 Walkthrough

Walkthrough

The scene trigger device-state buttons now use flex layout and shared wrapping styles. Binary, doorbell, and presence sensor components import the stylesheet and apply the deviceStateButton class.

Changes

Device state button layout

Layer / File(s) Summary
Apply shared button layout
front/src/routes/scene/edit-scene/triggers/device-states/*.jsx, front/src/routes/scene/edit-scene/triggers/style.css
The device-state buttons use flex containers and the shared deviceStateButton class. The stylesheet adds flexible sizing, full-height alignment, and wrapping for long labels.

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

Merge Risk: ⚪ Minimal · up to 700eb

The change only adjusts wrapping and alignment for long device-state labels; no actionable merge-blocking risk remains after normal checks and review.

Poem

A rabbit hops through buttons bright,
Flexing columns left and right.
Long labels wrap and stay in place,
Neat device states in tidy space.
Thump, thump—layout wins the race!

🚥 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 and concisely describes the main change: fixing long-label overflow in the device state change scene trigger.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files. (1 skipped: 1 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/device-state-trigger-button-text

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 18, 2026

Copy link
Copy Markdown

Deploying gladys-plus with  Cloudflare Pages  Cloudflare Pages

Latest commit: 700eb43
Status: ✅  Deploy successful!
Preview URL: https://c21f84c9.gladys-plus.pages.dev
Branch Preview URL: https://claude-device-state-trigger.gladys-plus.pages.dev

View logs

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.53%. Comparing base (ef4c6f7) to head (700eb43).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2943   +/-   ##
=======================================
  Coverage   99.53%   99.53%           
=======================================
  Files        1258     1258           
  Lines       91191    91191           
=======================================
  Hits        90770    90770           
  Misses        421      421           

☔ 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-device-state-trigger-button-text

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-device-state-trigger-button-text \
  -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-device-state-trigger-button-text

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 approved these changes Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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

Re-reviewed after merging master into claude/device-state-trigger-button-text. The four-file front diff is unchanged; the merge did not alter these trigger widgets or the layout they sit in.

Tabler’s .btn still ships white-space: nowrap, and the two state buttons still live in col-6 inside a col-md-5 column, so long labels (French motion: “Mouvement détecté” / “Pas de mouvement”) were clipped. The shared deviceStateButton class is the right fix: white-space: normal overrides the theme, overflow-wrap: anywhere covers a single unbreakable word, and stretching the button in a d-flex column keeps a pair aligned when only one label wraps.

Covering BinaryDeviceState (the reported widget) plus PresenceSensorDeviceState and DoorbellRingDeviceState is complete for this trigger — the other device-state widgets use react-select. Leaving the translations alone is the right call: wrapping holds for every language and any future long value label. No server/utils/constants.js category/type changes, and no behavior change.

CSS-module import of triggers/style.css matches CalendarEventIsComing.jsx; the hashed class + later chunk load beats .btn at equal specificity. Front test/build, Cypress, and Docker are green on this SHA.

Not risk:high. Not needs:human-review.

Residual (not this PR): Server test is red here on two Device.migrate 2s timeouts (should move the whole history in slices…, should cap each statement when every state shares the same timestamp). Same suite was green on 23d58eb; this change does not touch the server. That flake should not block this CSS fix.

Open in Web View Automation 

Sent by Cursor Automation: Automatic PR review

@Pierre-Gilles
Pierre-Gilles added this pull request to the merge queue Aug 21, 2026
Merged via the queue into master with commit 915fded Aug 21, 2026
18 of 19 checks passed
@Pierre-Gilles
Pierre-Gilles deleted the claude/device-state-trigger-button-text branch August 21, 2026 16:41
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.

2 participants