Skip to content

Fixed: fold long link values in the response headers again - #560

Merged
mnot merged 3 commits into
mainfrom
claude/location-header-folding-07ee7d
Oct 28, 2026
Merged

mnot merged 3 commits into
mainfrom
claude/location-header-folding-07ee7d

Conversation

@mnot

@mnot mnot commented Oct 28, 2026

Copy link
Copy Markdown
Owner

A long Location value (e.g., a Google /sorry/index?continue=... redirect) no longer folds in the response header box. It drops to its own line and runs off the right edge, with a horizontal scrollbar.

This regressed in 39f4a7f, when the headers became a list. Folding used to happen in Python (HeaderPresenter._wrap); that commit removed it and left wrapping to CSS (overflow-wrap: anywhere on #response li). But Location, Content-Location and X-XRDS-Location are rendered as links, and a link to a new test is a POST form with an <input type="submit">. A native input's text can't wrap, whatever the CSS says.

The fix renders those links as <button type="submit"> instead, and lets .post_link wrap inside the response box. Class names are unchanged. The browser test that clicks "check embedded" now selects the button.

Checked:

  • Reproduced the overflow on a static page using the compiled style.css; a plain <a> wrapped and the submit input didn't.
  • Ran REDbot against a local server returning a 302 with a long Location; the value wraps with the hanging indent.
  • make test_webui, test/test_html_escaping.py, make lint_py and make typecheck_py pass.

Not checked: the multi-resource table view, where .post_link is also used, and mobile widths.


AI-generated (Claude Code). Mark reported the regression from a screenshot and approved the root cause and approach before any change was made; the diff hasn't had a line-by-line human review yet.

🤖 Generated with Claude Code

mnot and others added 3 commits October 28, 2026 14:30
Since the headers became a list (39f4a7f), folding is left to CSS. A
Location value is a link, and links to a new test were an <input
type="submit">, whose text can't wrap. A long value therefore sat on its
own line and ran off the box.

Render the link as a <button> instead, and let it wrap inside the
response box. The browser test that clicks "check embedded" selects the
button now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The status-link assertions matched value="301" on the old submit input.
The negative one would have passed vacuously with a button, so both now
match the button's text.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…escaped

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mnot

mnot commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Independent review of 8a15f51, by a separate Claude subagent that was given the diff and not the author's conclusions. I haven't re-run its checks by hand, apart from the test fixes noted below.

It found no blockers. It measured the Location link on main at 663px to 3063px wide inside a 690px box; on this branch it wraps at 568px (269px at 375px width), with the hanging indent intact and no page-level overflow. That was Chromium only, light and dark; Firefox and WebKit weren't available.

One claim in the review was wrong: it said test_multi was the only test that depended on the old markup. test/test_table_view.py also did, and CI caught it. Fixed in 3e825de. The negative assertion there (assertNotIn('value="301"')) would have kept passing for the wrong reason, so both now match >301</button>.

Checked, nothing found

  • Escaping: a Location of </button><script>... and & ' " < > renders as an escaped button body; title, class and the hidden inputs are escaped too.
  • Other code on the old markup: serializeForm only reads hidden inputs, form.onsubmit still fires, and Enter on a focused button runs "check embedded" end to end.
  • Table view, content view (content_links), saved results (check_link uses <a> there) and the 12 browser tests behave as on main.
  • style.css differs from main only by the two intended rules. It couldn't run sass, so red_style.css was checked by reading, not rebuilt.

Findings

  1. Nit, inherent to the approach. A button is an atomic inline-block, so if the value doesn't fit after Location: the whole URL drops to the next line, even when a prefix would have fitted. Still much better than overflow. Left as is; this is for the maintainer to decide.
  2. Improvement, no action. input:focus { outline: 0 } no longer matches, so keyboard focus on these links now shows a focus ring.
  3. Behaviour change, left as is. font: inherit also inherits font-weight, so the Location link goes bold with the .hdr.hilight highlight (an <a> would too).
  4. Test gaps. Fixed in 87f3a88: test_long_location_folds checks the link's right edge stays inside #response and that it spans more than one line (it fails against the old markup), and test_location_is_escaped_once now checks the button body. Keyboard activation still isn't tested.
  5. Pre-existing, left alone. table#summary a.fade never matches, because the link has been an input and is now a button; the fade class is dead CSS either way.
  6. Nit. The first commit message says "links to a new test were an <input type="submit">", which reads badly. Not rewriting pushed history.

AI-generated review (Claude Code), posted at Mark's request; no human has reviewed the diff line by line yet.

🤖 Generated with Claude Code

@mnot
mnot merged commit 0bbdd48 into main Oct 28, 2026
7 checks passed
@mnot
mnot deleted the claude/location-header-folding-07ee7d branch October 28, 2026 03:59
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