Skip to content

fix(ui): enhance UI component interaction and accessibility - #122391

Closed
ZhouJian430 wants to merge 4 commits into
openclaw:mainfrom
ZhouJian430:pr/ui-interaction-accessibility-enhancements
Closed

ZhouJian430 wants to merge 4 commits into
openclaw:mainfrom
ZhouJian430:pr/ui-interaction-accessibility-enhancements

Conversation

@ZhouJian430

Copy link
Copy Markdown

Summary

This PR bundles interaction and accessibility improvements for three Control UI components:

Changes

1. ResizableDivider - Enhanced interaction experience

  • Added visual drag handle with directional icon (double-arrow SVG)
  • Expanded hit testing area from -4px to -8px for easier grabbing
  • Added keyboard hint overlay showing ArrowLeft/ArrowRight shortcuts
  • Added haptic feedback on mobile devices for drag and keyboard events
  • Added screen reader announcements for resize direction and percentage
  • Improved hover and drag state visual feedback with color transitions

2. ThemeModeToggle - Keyboard navigation

  • Added ArrowLeft/ArrowRight keyboard navigation for cycling through theme modes
  • Implemented roving tabindex pattern for proper focus management
  • Focus moves to newly selected mode button after keyboard navigation

3. CopyButton - Improved interaction state management

  • Refined copy feedback states and transitions
  • Better handling of copy success/failure states

Why This Change Was Made

These improvements address UI interaction discoverability and accessibility:

  • Keyboard users can now navigate theme modes and adjust split views efficiently
  • Screen reader users receive proper announcements for state changes
  • Mobile users get tactile feedback for interactions
  • Visual improvements make interactive elements more discoverable

User Impact

  • Keyboard-only users can now fully operate theme toggle and resizable divider
  • Screen reader users receive audible feedback for resize percentage and direction
  • All users benefit from clearer visual affordances for interactive elements

Evidence

  • ui/src/components/resizable-divider.ts: 210 lines added
  • ui/src/components/resizable-divider.test.ts: 97 lines added (comprehensive test coverage)
  • ui/src/components/theme-mode-toggle.ts: 67 lines modified
  • ui/src/components/copy-button.ts: 128 lines modified

All changes follow LitElement best practices and maintain backward compatibility.

🤖 Generated with Claude Code

- Add ArrowLeft/ArrowRight keyboard navigation for cycling through theme modes
- Implement roving tabindex pattern for better accessibility
- Extract getNextMode helper for clean mode cycling logic
- Pre-compute icons in options array for cleaner render function

This improves accessibility by allowing keyboard-only users to switch
between system, light, and dark theme modes using arrow keys, following
standard radio group interaction patterns.
- Add visual handle with drag direction indicator icon
- Expand hit testing area from -4px to -8px for easier grabbing
- Add keyboard hint overlay showing arrow key shortcuts (← →)
- Provide haptic feedback on mobile devices for drag and keyboard events
- Add screen reader announcements for resize direction and percentage
- Improve hover and drag state visual feedback with color transitions
- Add comprehensive test coverage for new interaction features

Fixes interaction discoverability and accessibility for split view resizing.
- Replace ad-hoc dataset flags with typed CopyButtonState machine
- Add proper timeout cleanup to prevent leaks when buttons unmount
- Handle clipboard errors with try-catch for better resilience
- Add keyboard support (Enter/Space) for accessibility
- Reset button state on mouseleave for faster feedback dismissal
- Check isConnected before manipulating detached button elements
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 12, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The PR adds divider hints, vibration and resize announcements, arrow-key theme selection, and a new clipboard feedback state machine to the Control UI.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The useful accessibility direction lacks real browser proof and contains four definite implementation defects.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🧂 unranked krab (1/6) 4 actionable review findings remain.

Merge readiness

⛔ Blocked before merge - 10 items remain

Useful interaction improvements remain distinct from merged work, but four source-proven defects and absent browser proof prevent a merge-ready verdict. Check activity on September 27 also prevents stalled or abandoned closure.

Priority: P2
Reviewed head: ae67f2e41b273b8de5692a4eb77d81e70697d101

Before merge

  • Add real behavior proof - The changed clipboard, theme and divider owners have no demonstrated after-fix browser interaction in the captured body or discussion; JSDOM input and mocked vibration are supplemental only. Provide redacted browser recording, screenshots or logs showing the changed feedback, keyboard focus and resize announcements. No stored-data contract changes are introduced. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Preserve the terminal state when scheduling its reset (P2) - Every success or failure calls this scheduler immediately after setting __copyState, but cleanupButtonState deletes that field. The timeout's state comparison consequently fails, leaving the copied icon or error feedback active indefinitely, including for keyboard users who never trigger mouseleave. Clear the previous timer without deleting the state needed by this reset.
  • Announce the clamped resize result (P2) - The announcement receives the requested ratio before emitResize clamps it. With the default maximum of 70%, pressing ArrowRight at that limit announces 72% while the actual layout and ARIA value remain 70%. Clamp once and use the resulting value for both resizing and announcements, avoiding a false change announcement at a boundary.
  • Keep the announcement inside its hiding-style scope (P2) - The .visually-hidden rule belongs to this component's shadow root, but this code appends the announcement to document.body. No global rule styles that class, so each keyboard resize inserts visible announcement text into the page for one second and can alter page layout. Put the live region in the styled render root or give its actual owner an appropriate hiding rule. This was missed in the earlier review of the unchanged head.
  • Use the Lit template type for theme icons (P2) - icons.monitor, icons.sun and icons.moon are Lit html results, but the newly declared array requires icon: string. These assignments are incompatible with the UI's TypeScript contract. Infer the array type or declare the icon as TemplateResult. This type mismatch was missed in the earlier review of the unchanged head; a typecheck was not executed here.
  • Resolve merge risk - GitHub reports merge conflicts; the resolved candidate needs renewed review against current theme, divider and clipboard contracts because no pinned merge result is available.
  • Complete next step - Resolve conflicts against current main, fix the four findings, and provide redacted after-fix browser evidence before merge.
  • Improve patch quality - Fix all four findings and add focused reset, boundary-announcement, visibility and type validation.
  • Improve patch quality - Resolve conflicts against current component contracts and submit the refreshed candidate for review.
  • Improve patch quality - Add after-fix browser evidence, redact private details, and update the PR body to trigger re-review; if needed, ask a maintainer for @clawsweeper re-review.

Findings

  • [P2] Preserve the terminal state when scheduling its reset — ui/src/components/copy-button.ts:72-76
  • [P2] Announce the clamped resize result — ui/src/components/resizable-divider.ts:313-315
  • [P2] Keep the announcement inside its hiding-style scope — ui/src/components/resizable-divider.ts:325-327
Agent review details

How this fits together

Control UI components turn browser pointer and keyboard input into split-view resizing, theme changes, and clipboard writes. Their visual and accessible feedback tells users whether those interactions succeeded.

flowchart TD
  A[Pointer and keyboard input] --> B[Control UI components]
  B --> C[Resize split view]
  B --> D[Select theme]
  B --> E[Write clipboard]
  C --> F[Visual and accessible feedback]
  D --> F
  E --> F
Loading

Technical review

Best possible solution:

Apply the remaining accessibility affordances through the current component owners, with accurate localized announcements and reliable clipboard feedback.

Do we have a high-confidence way to reproduce the issue?

Yes for the introduced defects: source establishes the missing reset state, unclamped announcement, misplaced hiding style and incorrect icon type. No browser reproduction or test execution was performed.

Is this the best way to solve the issue?

No, this branch is not yet the best fix: its feedback implementation is defective and predates current component contracts; a focused refresh should reuse those owners and prove the remaining affordances.

Full review comments:

  • [P2] Preserve the terminal state when scheduling its reset — ui/src/components/copy-button.ts:72-76
    Every success or failure calls this scheduler immediately after setting __copyState, but cleanupButtonState deletes that field. The timeout's state comparison consequently fails, leaving the copied icon or error feedback active indefinitely, including for keyboard users who never trigger mouseleave. Clear the previous timer without deleting the state needed by this reset.
    Confidence: 1
  • [P2] Announce the clamped resize result — ui/src/components/resizable-divider.ts:313-315
    The announcement receives the requested ratio before emitResize clamps it. With the default maximum of 70%, pressing ArrowRight at that limit announces 72% while the actual layout and ARIA value remain 70%. Clamp once and use the resulting value for both resizing and announcements, avoiding a false change announcement at a boundary.
    Confidence: 1
  • [P2] Keep the announcement inside its hiding-style scope — ui/src/components/resizable-divider.ts:325-327
    The .visually-hidden rule belongs to this component's shadow root, but this code appends the announcement to document.body. No global rule styles that class, so each keyboard resize inserts visible announcement text into the page for one second and can alter page layout. Put the live region in the styled render root or give its actual owner an appropriate hiding rule. This was missed in the earlier review of the unchanged head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Use the Lit template type for theme icons — ui/src/components/theme-mode-toggle.ts:73-76
    icons.monitor, icons.sun and icons.moon are Lit html results, but the newly declared array requires icon: string. These assignments are incompatible with the UI's TypeScript contract. Infer the array type or declare the icon as TemplateResult. This type mismatch was missed in the earlier review of the unchanged head; a typecheck was not executed here.
    Confidence: 1
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6cae5628b09a.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Apply the remaining accessibility affordances through the current component owners, with accurate localized announcements and reliable clipboard feedback.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Security

None.

Evidence

What I checked:

  • Verified introduced scope: Reviewed the merge-base-to-head patch and complete changed modules. The checkout equals the pinned original head; current-main differences were not attributed to this PR. (ae67f2e41b27)
  • Clipboard reset defect: The scheduler calls cleanupButtonState, which deletes __copyState, before installing a timeout that requires that same state. Both success and failure feedback therefore remain active after their reset deadlines. (ui/src/components/copy-button.ts:73, ae67f2e41b27)
  • Announcement defects: Keyboard handling announces the unclamped requested ratio. The announcement is appended to document.body although its hiding rule exists only in component shadow styles; no global visually-hidden rule was found. (ui/src/components/resizable-divider.ts:313, ae67f2e41b27)
  • Icon type mismatch and dependency signal: The introduced options array requires icon: string, but icons.monitor, icons.sun and icons.moon are produced by Lit's html tag. Direct imports and these assignments establish the Lit dependency contract relevant to this finding; no Codex dependency signal exists. (ui/src/components/theme-mode-toggle.ts:73, ae67f2e41b27)
  • Upstream template contract: Verified repository identity through GitHub and inspected pinned upstream source. TemplateResult is an object containing template strings and values, and the html tag returns that object rather than a string. (packages/lit-html/src/lit-html.ts:480, 01dbc6673cdc)
  • Upstream style boundary: ReactiveElement creates a shadow root and adopts component styles into that render root. This confirms that the divider's component-local hiding class does not style an announcement appended to document.body. (packages/reactive-element/src/reactive-element.ts:1120, 01dbc6673cdc)

PR surface

Source +299, Tests +93. Total +392 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 352 53 +299
Tests 1 95 2 +93
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 447 55 +392

Review metrics

Metric Value Why it matters
Production versus test growth production +299 lines; tests +93 lines Growth adds interaction affordances and feedback handling, but regression coverage misses the new reset and announcement defects.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The changes affect bounded browser interaction and accessibility behavior without evidence of an urgent core workflow outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 3, 2026, 1:25 PM ET / 17:25 UTC.

@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 12, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 12, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 27, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 14, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

@vincentkoc vincentkoc closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants