Repository navigation
fix(viewer): inset in-table focus rings and let long meta values wrap - #1465
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
|
@misslead Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. |
|
Hi @lizhengfeng101 - thanks for the pointer! The CLA was signed right after opening: the |
Fixes alibaba#1455 This lands items 1-3 of alibaba#1455 and records a decision on item 4. `.table a:focus-visible` carries `outline-offset: -2px`, but three rules are more specific and kept `+2px`, so the inset only ever applied to the sessions `Compare` link. All three now use `-2px`: - `.sessions-page .session-id:focus-visible` - `.repos-page .col-repository a:focus-visible` - `.repos-page .repo-check:focus-visible` `TestFocusCSS_CoversCollapsiblesAndTableLinks` only asserted that the selector existed, which passes just as happily with the wrong value. It now reads each rule block and asserts the effective `outline-offset: -2px`. `.meta span` is `display: flex`, so the value is an anonymous flex item whose min-content is the whole path: `max-width: 100%` alone left it clipped by the inherited `overflow: hidden`, with no ellipsis (`text-overflow` does not apply to a flex container). The 768px override now adds `flex-wrap: wrap` and `overflow-wrap: anywhere`, and lets `.meta-truncate` overflow visibly. `TestResponsiveCSS_MetaOverrideComesAfterBase` matched the old declarations literally, so the strings are updated; the cascade guard itself is unchanged. `export.go` prepends `a11y.js` ahead of `session.js`, which calls `window.ocrArrowScroll` on its first line. Dropping the concatenation throws on line 1 and takes every bit of interactivity with it. - `TestExportSession_SelfContained` now asserts the inlined script carries `window.ocrArrowScroll`. - `TestHandleSession_ServedPageKeepsStaticRefs` now asserts `src="/static/a11y.js"` alongside the existing session.js reference. - New `TestStaticAssetRefs_OnReposAndSessionsPages` covers repos.html and sessions.html, which reference the same script. The three panel surfaces measure 4.61-4.84 against both themes, so they do clear AA; the tightest margin is 0.11. Extending `TestTextTokens_MeetWCAGAAOnPageBackground` requires blending the token alpha over each surface color instead of over the page background - the current helper treats the page as pure black or pure white, which only holds for `--bg`. That is a real change to the luminance helper and belongs in its own PR rather than folded into a CSS fix. Happy to follow up with it if you would rather have it here. `go test ./internal/viewer/ -count=1` passes, `go vet ./internal/viewer/` passes, `gofmt -s -l` is clean, and `go run scripts/verify-english-only.go` reports no unapproved non-English text. Items 1-2 still want a browser check at 375px and at desktop width, light and dark. I could not run a browser here, so that part is unverified.
cbc5313 to
8b1a74d
Compare
|
Rebased onto How the conflict was resolved (
The other three files ( Verification on the rebased commit ( The two browser checks from the original description (375px and desktop width, light and dark) are still unverified here: this environment cannot run a browser. |
NanaseInori
left a comment
There was a problem hiding this comment.
Reviewed the complete four-file diff, #1455, the rebase discussion, the current responsive CSS and the shared/script call sites. I also inspected merged #1458: it covers the mobile metadata wrapping, but not the three focus-offset changes and the added script-reference checks here. Those remaining changes retain independent value.
The three more-specific focus rules now use the same inset offset as the table-link rule. The tests check their declaration values rather than selector presence alone. The strict mobile literals agree with the CSS already present at this head; their absence from the remaining CSS diff is explained by the merged predecessor, not a missing implementation. The export assertion names the window.ocrArrowScroll definition supplied by a11y.js, while session.js invokes ocrArrowScroll, and the served-page assertions retain pager.js alongside a11y.js. I found no blocking defect in these changes.
Approval is based on source and test inspection. I did not execute the Go suite or inspect rendering/keyboard focus at 375px and desktop widths in both themes. Those browser acceptance checks remain outstanding as disclosed by the author. The separate panel-surface contrast-test expansion is explicitly deferred; I have not independently verified its numerical contrast claims.
This review was conducted by NanaseInori's review bot, using the model GPT-6 Astra Pro. If you need a human review, please manually @NanaseInori.
Fixes #1455
This lands items 1-3 of #1455 and records a decision on item 4.
1. In-table focus rings were still clipped
.table a:focus-visiblecarriesoutline-offset: -2px, but three rules are more specific and kept+2px, so the inset only ever applied to the sessionsComparelink. All three now use-2px:.sessions-page .session-id:focus-visible.repos-page .col-repository a:focus-visible.repos-page .repo-check:focus-visibleTestFocusCSS_CoversCollapsiblesAndTableLinksonly asserted that the selector existed, which passes just as happily with the wrong value. It now reads each rule block and asserts the effectiveoutline-offset: -2px.2. A long CWD or branch stayed unreadable at narrow widths
.meta spanisdisplay: flex, so the value is an anonymous flex item whose min-content is the whole path:max-width: 100%alone left it clipped by the inheritedoverflow: hidden, with no ellipsis (text-overflowdoes not apply to a flex container). The 768px override now addsflex-wrap: wrapandoverflow-wrap: anywhere, and lets.meta-truncateoverflow visibly.TestResponsiveCSS_MetaOverrideComesAfterBasematched the old declarations literally, so the strings are updated; the cascade guard itself is unchanged.3. The exported page's script concatenation had no test
export.goprependsa11y.jsahead ofsession.js, which callswindow.ocrArrowScrollon its first line. Dropping the concatenation throws on line 1 and takes every bit of interactivity with it.TestExportSession_SelfContainednow asserts the inlined script carrieswindow.ocrArrowScroll.TestHandleSession_ServedPageKeepsStaticRefsnow assertssrc="/static/a11y.js"alongside the existing session.js reference.TestStaticAssetRefs_OnReposAndSessionsPagescovers repos.html and sessions.html, which reference the same script.4. WCAG coverage for the panel surfaces: not landed, and why
The three panel surfaces measure 4.61-4.84 against both themes, so they do clear AA; the tightest margin is 0.11. Extending
TestTextTokens_MeetWCAGAAOnPageBackgroundrequires blending the token alpha over each surface color instead of over the page background - the current helper treats the page as pure black or pure white, which only holds for--bg. That is a real change to the luminance helper and belongs in its own PR rather than folded into a CSS fix. Happy to follow up with it if you would rather have it here.Verification
go test ./internal/viewer/ -count=1passes,go vet ./internal/viewer/passes,gofmt -s -lis clean, andgo run scripts/verify-english-only.goreports no unapproved non-English text.Items 1-2 still want a browser check at 375px and at desktop width, light and dark. I could not run a browser here, so that part is unverified.