Skip to content

fix(control-ui): make chat divider accessible - #74293

Merged
BunsDev merged 5 commits into
mainfrom
meow/chat-divider-a11y
Apr 29, 2026
Merged

BunsDev merged 5 commits into
mainfrom
meow/chat-divider-a11y

Conversation

@BunsDev

@BunsDev BunsDev commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: the chat sidebar split divider was mouse-only and exposed no separator semantics.
  • Why it matters: keyboard and touch users could not resize a core chat workflow surface.
  • What changed: the Lit divider now exposes separator ARIA, focusability, current/min/max values, keyboard resize controls, and pointer-event drag handling.
  • What did NOT change (scope boundary): no sidebar layout policy, split-ratio persistence, Gateway behavior, or markdown sidebar rendering changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: resizable-divider only listened for mousedown / document mouse events and rendered no accessible host semantics.
  • Missing detection / guardrail: no component test asserted keyboard or ARIA behavior for the split divider.
  • Contributing context (if known): the divider renders as an empty custom element host, so it needed host-level separator semantics and interaction handlers.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: ui/src/ui/components/resizable-divider.test.ts
  • Scenario the test should lock in: separator ARIA values, Arrow/Home/End keyboard resizing, focus on pointer drag, and pointer-based resize events.
  • Why this is the smallest reliable guardrail: the bug is isolated to the reusable divider custom element and its emitted resize contract.
  • Existing test that already covers this (if any): none.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

The chat sidebar divider can now be focused, resized with keyboard controls, announced as a vertical separator, and dragged via pointer events.

Diagram (if applicable)

Before:
[mouse drag only] -> [resize event]

After:
[keyboard or pointer input] -> [clamped split ratio] -> [resize event]

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS local dev + Blacksmith Testbox Linux runner
  • Runtime/container: Node 22 / pnpm workspace
  • Model/provider: N/A
  • Integration/channel (if any): Control UI chat
  • Relevant config (redacted): N/A

Steps

  1. Open the Control UI chat with sidebar content visible.
  2. Focus the split divider between chat and sidebar.
  3. Press ArrowLeft/ArrowRight/Home/End or drag with pointer input.

Expected

  • Divider is announced as a vertical separator with current/min/max values and resizes the split without requiring a mouse.

Actual

  • Before this PR, only mouse drag worked and the divider was not keyboard-focusable or semantically exposed.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Added ui/src/ui/components/resizable-divider.test.ts to cover the accessibility contract.

Human Verification (required)

  • Verified scenarios:
    • pnpm test ui/src/ui/components/resizable-divider.test.ts
    • pnpm exec oxfmt --check --threads=1 ui/src/ui/components/resizable-divider.ts ui/src/ui/components/resizable-divider.test.ts ui/src/ui/views/chat.ts
    • git diff --check -- CHANGELOG.md ui/src/ui/components/resizable-divider.ts ui/src/ui/components/resizable-divider.test.ts ui/src/ui/views/chat.ts
    • pnpm tsgo:test:ui
    • pnpm tsgo:core
    • OPENCLAW_TESTBOX=1 pnpm check:changed in Blacksmith Testbox tbx_01kqcespxywjcc0z7rx6k3242q
  • Edge cases checked: clamping at min/max, shifted arrow increments, Home/End, pointer drag cleanup.
  • What you did not verify: visual browser screenshot; this patch is a host-level interaction/semantics change with no layout redesign.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

No review conversations existed at PR creation time; I will inspect live thread state after creation.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: keyboard step size might feel too small or too large.
    • Mitigation: uses small 2% default increments, 5% with Shift, and Home/End for exact bounds.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Apr 29, 2026
@greptile-apps

greptile-apps Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR upgrades resizable-divider from mouse-only drag to full accessibility: pointer events (replacing mouse events), keyboard resize (Arrow/Home/End), ARIA separator semantics, and focus handling. The chat.ts wires in an i18n label. The implementation is clean and the controlled-component contract is preserved.

Confidence Score: 4/5

Safe to merge — all findings are P2 style/quality suggestions with no functional regressions.

Only P2 findings: the test helper uses MouseEvent instead of PointerEvent (reducing coverage of touch/stylus-specific behavior), static ARIA attributes are re-set on every render, and setPointerCapture is absent. None of these block correctness of the feature in its primary use cases.

ui/src/ui/components/resizable-divider.test.ts — the pointer dispatch helper should use PointerEvent to actually test the new pointer-event path.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/ui/components/resizable-divider.test.ts
Line: 57-63

Comment:
**Test uses `MouseEvent` instead of `PointerEvent`**

`dispatchPointer` creates `new MouseEvent(type, ...)` for events named `"pointerdown"`, `"pointermove"`, and `"pointerup"`. The component switched from mouse to pointer events specifically to support touch and stylus, but the test never exercises actual `PointerEvent` instances. `PointerEvent`-specific fields like `pointerId`, `pointerType`, and `isPrimary` are never set, so the interaction with `setPointerCapture` (if added) and multi-touch guards won't be covered. Use `new PointerEvent(type, { bubbles: true, cancelable: true, clientX, button: 0, pointerId: 1 })` instead.

```suggestion
function dispatchPointer(target: EventTarget, type: string, clientX: number) {
  target.dispatchEvent(
    new PointerEvent(type, {
      bubbles: true,
      cancelable: true,
      clientX,
      button: 0,
      pointerId: 1,
    }),
  );
}
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: ui/src/ui/components/resizable-divider.ts
Line: 81-96

Comment:
**Missing `setPointerCapture` for reliable drag tracking**

Without capturing the pointer, fast drags can leave the element's hit-area before `document` listeners fire, causing `pointermove` events to be silently dropped on some browsers when the pointer moves faster than the event loop. `setPointerCapture` routes all subsequent pointer events to this element regardless of position, which is the canonical solution — especially important for touch/stylus (the primary motivation for moving from mouse to pointer events).

```suggestion
  private handlePointerDown = (e: PointerEvent) => {
    if (e.button !== 0) {
      return;
    }
    this.isDragging = true;
    this.startX = e.clientX;
    this.startRatio = this.splitRatio;
    this.classList.add("dragging");
    this.focus();
    this.setPointerCapture(e.pointerId);

    document.addEventListener("pointermove", this.handlePointerMove);
    document.addEventListener("pointerup", this.handlePointerUp);
    document.addEventListener("pointercancel", this.handlePointerUp);

    e.preventDefault();
  };
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: ui/src/ui/components/resizable-divider.ts
Line: 67-79

Comment:
**Static ARIA attributes set on every render**

`role`, `tabindex`, and `aria-orientation` are invariant — they never change after the element is constructed. Setting them in `updated()` re-applies them on every property change (e.g., every `splitRatio` update during drag). Only the value attributes (`aria-valuemin`, `aria-valuemax`, `aria-valuenow`, `aria-label`) need reactive updates. The static ones can be moved to `connectedCallback` to avoid the repeated DOM writes on hot paths.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(control-ui): make chat divider acces..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

The PR updates the Control UI resizable divider with ARIA separator semantics, focusability, keyboard resize controls, pointer-event dragging, a localized chat label, component tests, a changelog entry, and an optional Knip unused-file allowlist path in the deadcode checker.

Maintainer follow-up before merge:

Keep this PR open for maintainer review. If accepted, land this branch or an equivalent divider-level accessibility fix that preserves the existing split-ratio resize contract, uses the existing localized nav.resize label, keeps focused component coverage, and either accepts or splits the optional Knip allowlist cleanup.

Best possible solution:

Keep this PR open for maintainer review. If accepted, land this branch or an equivalent divider-level accessibility fix that preserves the existing split-ratio resize contract, uses the existing localized nav.resize label, keeps focused component coverage, and either accepts or splits the optional Knip allowlist cleanup.

What I checked:

  • Protected PR routing: Provided GitHub context shows this PR is open and unmerged, authored by BunsDev with authorAssociation: MEMBER, and labeled maintainer; repository cleanup policy keeps maintainer-owned or protected-label PRs open for explicit maintainer handling. (75f529fa42b4)
  • Current main divider is still mouse-only: Current main registers mousedown plus document mousemove/mouseup handlers and has no role, tabindex, ARIA value attributes, keyboard handler, pointer events, focus styling, or label property. (ui/src/ui/components/resizable-divider.ts:46, 4f540c703ff6)
  • Current chat wiring lacks accessible label: Current main renders <resizable-divider> with only splitRatio and a resize listener, so the existing localized resize label is not passed to the divider. (ui/src/ui/views/chat.ts:1068, 4f540c703ff6)
  • Existing locale supports PR direction: The English Control UI locale already defines nav.resize: "Resize sidebar", matching the label the PR wires into chat. (ui/src/i18n/locales/en.ts:153, 4f540c703ff6)
  • Current main lacks divider-specific coverage: Search found the divider implementation and chat usage but no colocated resizable-divider.test.ts or existing ARIA/keyboard/pointer coverage for this component on current main. (ui/src/ui/components/resizable-divider.ts:105, 4f540c703ff6)
  • PR diff review: The PR diff adds the accessibility behavior and component tests, wires t("nav.resize") in chat, updates the changelog, and also adjusts the deadcode unused-file checker to support an optional Knip allowlist entry. (75f529fa42b4)

Likely related people:

  • steipete: Current-main blame/log for resizable-divider.ts, the chat split rendering, the English locale entry, and recent deadcode allowlist/checker commits points to Peter Steinberger around the affected UI and script paths. (role: current-main path maintainer and adjacent scripts owner; confidence: medium; commits: 4528682487bf, 7214b40a7b81, fc49f94ccf42; files: ui/src/ui/components/resizable-divider.ts, ui/src/ui/views/chat.ts, ui/src/i18n/locales/en.ts)
  • BunsDev: Beyond authoring this PR, local current-main history shows BunsDev/Val Alexander recently landed adjacent Control UI component work for modal dialogs, making them relevant for routing the UI component review. (role: proposed fix owner and recent adjacent Control UI contributor; confidence: medium; commits: e5a5ea10722e, 75f529fa42b4; files: ui/src/ui/components/modal-dialog.ts, ui/src/ui/components/modal-dialog.test.ts, ui/src/ui/components/resizable-divider.ts)

Remaining risk / open question:

  • This PR has the protected maintainer label and MEMBER author association, so automated cleanup should not close or replace it.
  • Current main still lacks the accessible divider behavior, so closing this PR before merge would drop an active fix for a real Control UI accessibility gap.
  • The PR includes deadcode-checker script and allowlist changes in addition to the UI accessibility fix; the diff does not show a supply-chain or secrets regression, but maintainers should decide whether that CI workaround belongs in this PR or should be split.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 4f540c703ff6.

@BunsDev BunsDev self-assigned this Apr 29, 2026
@BunsDev
BunsDev force-pushed the meow/chat-divider-a11y branch from 48ff245 to 3428ede Compare April 29, 2026 11:25
@BunsDev

BunsDev commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up after review cleanup:

  • Greptile posted three P2 threads and no P0/P1 findings.
  • The PointerEvent test thread is resolved/outdated after the branch update.
  • The pointer-capture and static-ARIA threads are addressed in 3428edecf4 and resolved with replies.
  • OPENCLAW_TESTBOX=1 pnpm check:changed passed on the final branch diff after clearing stale Testbox-only workspace state; selected lanes were core/coreTests/docs for the divider files.
  • GitHub full CI is currently red on unrelated extensions/github-copilot/index.ts extension type errors (agentDir, loadCatalog). The branch diff is still limited to CHANGELOG.md, ui/src/ui/components/resizable-divider.ts, ui/src/ui/components/resizable-divider.test.ts, and ui/src/ui/views/chat.ts, and the same extension typecheck failure reproduces locally with pnpm tsgo:extensions.

@BunsDev
BunsDev force-pushed the meow/chat-divider-a11y branch 2 times, most recently from f0afafb to 146ecd2 Compare April 29, 2026 11:48
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Apr 29, 2026
@BunsDev
BunsDev force-pushed the meow/chat-divider-a11y branch from 75f529f to 8ac3936 Compare April 29, 2026 12:03
@BunsDev
BunsDev merged commit efb1a7c into main Apr 29, 2026
75 checks passed
@BunsDev
BunsDev deleted the meow/chat-divider-a11y branch April 29, 2026 12:07
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 maintainer Maintainer-authored PR scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant