Skip to content

fix(web): Curves page text wraps - #6217

Merged
springfall2008 merged 1 commit into
mainfrom
fix/curves-page-wrap
Nov 15, 2026
Merged

springfall2008 merged 1 commit into
mainfrom
fix/curves-page-wrap

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

The shared page header sets p { white-space: nowrap }, so the Curves page captions (added in #6212) ran off the right of the window. The page's container now sets white-space: normal, as the Kraken key page already does for the same reason.

Tested by web_curves_chart (checks the container style) and web_if; pre-commit passes.

🤖 Generated with Claude Code

The shared page header sets p { white-space: nowrap }, so the Curves page captions ran off the right of the window.
The page's container now sets white-space: normal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the BOT_REVIEW Trigger an autotriage label Nov 15, 2026
@springfall2008
springfall2008 enabled auto-merge (squash) November 15, 2026 20:21
@springfall2008
springfall2008 merged commit 044e0ab into main Nov 15, 2026
6 checks passed
@springfall2008
springfall2008 deleted the fix/curves-page-wrap branch November 15, 2026 20:26

@springfall2008 springfall2008 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Automated comment from the triage bot.

Reviewed a6071b18b94e85dfbe04a5f637868b8c7fdffe4d. 2 findings, both inline.

The change sets white-space: normal on the page's container <div>, but the rule it is aiming at, p { white-space: nowrap } in the shared header (web_helper.py:8477-8479), is applied directly to the descendant <p> elements. An inherited value never overrides a declaration that matches the element itself, so the captions still compute to nowrap and still run off the right of the window. Every other override of this rule in the codebase targets the p rather than a wrapper, and web_chat.py:849 records the same conclusion in a comment. The added test pins the style-attribute string rather than the rule, so it reports green over an override that has no effect.

Comment thread apps/predbat/web.py
cell = "padding:6px 12px;border:1px solid #555;"
text = "<div style='max-width:960px;'>\n<br><h2>Battery rate grids</h2>\n"
# white-space: the shared header sets p { white-space: nowrap }, which would run the captions off the page
text = "<div style='max-width:960px;white-space:normal;'>\n<br><h2>Battery rate grids</h2>\n"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Automated comment from the triage bot.

This does not override the rule it is aiming at. white-space is an inherited property, but inheritance only supplies a value when no declaration matches the element itself, and the shared header's p { white-space: nowrap } (web_helper.py:8477-8479) matches each <p> in this page directly. The two captions (web.py:4060 and web.py:4115) therefore still compute to nowrap and still run off the right of the window, which is the reported symptom. The container's normal only reaches elements that have no rule of their own, and nothing here does: the <h2>, <h3> and <td> elements already inherited normal from body before this change, so the rendered page is unchanged.

Verified in the checked-out tree: every other override of this rule targets the p, not a container. .kraken-key p, .kraken-key label (web_helper.py:9749), .annual-form-wrap p, .annual-results p, ... (web_annual.py:1873), and #chat-page p, #chat-page li, ... (web_chat.py:853), whose comment at web_chat.py:849 states the same reason: nowrap forbids wrapping outright, so no amount of overflow handling can act on it. The comment here says this is done "as the Kraken key page already does for the same reason", but the Kraken page's selector is on p and label, not on its wrapper.

Suggested shape, matching those three: give the div a class (e.g. curves-chart) and emit .curves-chart p { white-space: normal; } in a style block, or put white-space:normal on each <p> directly.

(If what actually overflows is the eight-column table rather than the paragraph, that needs overflow-x: auto on the wrapper instead: white-space does not constrain a table's width.)

failed |= _check("t1 learned yes/no", ">Yes</td>" in html and ">No</td>" in html)

print("Test 1b: the page wraps its text (the shared header sets p { white-space: nowrap })")
failed |= _check("t1b wraps", "max-width:960px;white-space:normal;" in html, html[:300])

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Automated comment from the triage bot.

This pins the style-attribute string rather than the behaviour it is meant to protect, so it passes over the container-level white-space: normal that does not actually make the caption wrap: the reported bug survives and this test still reports green. Any harmless edit to the attribute also fails it for no behavioural reason, for example reordering max-width and white-space or adding a third property.

The comparable tests elsewhere assert the rule rather than an attribute: test_web_annual.py:873 captures the selector preceding white-space: normal and requires it to name the paragraphs being wrapped. Once the override targets p, this test can assert the same way.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant