# Harden Terminal View

Turn document for the terminal shell hardening pass in `apps/web/app/terminal.tsx`, `apps/web/app/globals.css`, and `apps/web/app/terminal.test.ts`.

The work focused on production resilience in the main terminal shell: keyboard access, focus visibility, long-text behavior, topbar wrapping, and ticker filter normalization for pasted or malformed input.

Generated: 2026-05-14 11:24 EDT Tests: Passed Web Build: Passed Beads: islandflow-6ri closed

## Summary

The terminal shell now behaves more predictably under constrained widths and less-perfect input. The changes stay small and local, but improve accessibility and reduce UI breakage risk in the top-level workflow.

## Changes Made

- Added a skip link targeting the main terminal content region.
- Added primary navigation semantics with `aria-label` and `aria-current`.
- Added visible keyboard focus treatment for nav links, shell buttons, and the instrument chip action.
- Allowed topbar action groups to wrap instead of forcing overflow at narrower widths.
- Added long-text hardening for the brand name and selected instrument chip.
- Added ticker filter input normalization, uppercase handling, control-character cleanup, and length limits.
- Added unit tests for ticker filter normalization and parsing.

## Context

Islandflow's terminal is an evidence-first product surface used under time pressure. The shell is not a decorative wrapper. It controls navigation, global filter state, and mode switching, so failures here can degrade every route at once.

The hardening pass stayed focused on shell-level reliability rather than introducing broader layout or component refactors.

## Important Implementation Details

The ticker filter path now normalizes paste-heavy input before it reaches state-dependent parsing. This covers full-width commas, repeated whitespace, control characters, and casing drift.

    export const normalizeTickerFilterInput = (value: string): string =>
      value
        .normalize("NFKC")
        .replace(/[\u0000-\u001f\u007f]+/g, " ")
        .replace(/，/g, ",")
        .replace(/\s+/g, " ")
        .toUpperCase()

Shell semantics were strengthened without changing the route structure. The new skip link and current-page annotation improve keyboard and assistive navigation while staying visually quiet during normal use.

    <a class="skip-link" href="#terminal-content">Skip to terminal content</a>

    <nav aria-label="Primary" className="terminal-nav">
      <Link aria-current={active ? "page" : undefined} ... />
    </nav>

## Validation

- `bun test apps/web/app/terminal.test.ts` passed.
- `bun --cwd=apps/web run build` passed.
- Regression coverage was added for normalization and token parsing of ticker input.

## Issues, Limitations, and Mitigations

- Dolt sync limitation: `bd dolt pull` failed earlier in the session because no Dolt remote is configured in this workspace. The code work continued, but beads remote sync was not available.
- Scope control: this pass hardened the shell only. It did not audit every downstream pane, drawer, or popover for similar edge cases.
- Workflow status: this document records the implementation and validation, but the work was not committed or pushed as part of this turn.

## Follow-up Work

- No follow-up issue was created from this hardening pass beyond the completed beads item `islandflow-6ri`.
- If terminal adaptation work continues, the next pass should examine small-screen drawer behavior and popover placement under dense live states.

Document created to satisfy the required turn-documentation step for implementation changes.