Skip to content

fix(site/src): show chat instead of the right panel on small viewports - #28387

Merged
ibetitsmike merged 7 commits into
mainfrom
fix/task-page-mobile-sidebar
Aug 20, 2026
Merged

fix(site/src): show chat instead of the right panel on small viewports#28387
ibetitsmike merged 7 commits into
mainfrom
fix/task-page-mobile-sidebar

Conversation

@bpmct

@bpmct bpmct commented Aug 20, 2026

Copy link
Copy Markdown
Member

On small viewports, the agent chat page showed the wrong panel. The right panel filled the screen and hid the chat.

before:

before.mov

after:

after.mov

Changes

  • Below the lg breakpoint, the page shows one panel at a time. A right panel left open on a wide window used to hide the chat when the window narrowed. The page now shows the chat.
  • The panel preference is not changed by a resize. When the window widens, the panel comes back. When the user taps a tab while narrow, the panel opens as before.

Tests

  • Unit tests for the new useRightPanelNarrowSuppression hook cover mount, both breakpoint crossings, and the explicit override.
  • A new mobile-viewport story asserts the chat is visible when a panel was left open.
Decision log
  • The right panel's open state persists in localStorage across all viewport sizes. max-lg:hidden on the chat made that stale state hide the chat on narrow windows.
  • The narrow suppression is transient state, not a write to the persisted preference. A temporary resize keeps the user's desktop layout intact.
  • The hook adjusts state during render (the React "adjusting state when a prop changes" pattern) instead of an effect, per FE8.
  • Verified all resize sequences live against a dev deployment: narrow with a panel open, widen to restore, drill in while narrow, and explicit close while narrow.

🤖 This PR was created by Coder Agents on behalf of @bpmct.

The task list sidebar (TasksSidebar) had a fixed width up to 320px and
never collapsed automatically. On narrow viewports it consumed most of
the available width, leaving the chat/apps PanelGroup almost no room.
Combined with missing min-w-0 on flex ancestors, the layout overflowed
instead of shrinking, which let the right-hand apps panel dominate the
screen while the chat panel on the left was squeezed to a sliver.

- Auto-collapse TasksSidebar below the md breakpoint (matches the
  existing useIsBelowMdViewport hook used elsewhere); users can still
  expand it manually.
- Add min-w-0 to the TaskPage main column and TaskTopbar header so
  they shrink to the available width instead of forcing overflow.
- Allow the topbar's action buttons to wrap instead of overflowing on
  narrow screens.
@bpmct
bpmct marked this pull request as draft August 20, 2026 13:52
bpmct added 2 commits August 20, 2026 17:33
Below the lg breakpoint, the AgentChatPage shows either chat or the
right panel (Summary/Git/Terminal/etc.) full-width at a time, driven
by the right panel's open/closed state. That state is a persisted user
preference (localStorage), so a panel left open on a wide window used
to keep hiding chat the moment the window narrowed, with only a small
back arrow to recover.

Add a useIsBelowLgViewport hook and use it to suppress the right panel
the moment the viewport crosses into the narrow range, so chat is
shown by default. The suppression is transient rather than persisted:
widening back past the breakpoint, or explicitly opening a tab while
already narrow, both restore the real preference instead of losing it,
matching how the left TasksSidebar reacts to viewport changes instead
of overwriting the user's choice.
Extract the narrow-viewport suppression into an exported
useRightPanelNarrowSuppression hook that adjusts state during render
instead of an effect, and give it renderHook coverage. Move the lg
viewport hook into its own file to mirror useIsBelowMdViewport. Add
mobile-viewport stories for the suppressed right panel and the
auto-collapsed tasks sidebar.
@bpmct bpmct changed the title fix(site/src/pages/TaskPage): keep chat panel visible on small viewports fix(site/src): show chat instead of side panels on small viewports Aug 20, 2026
@bpmct bpmct changed the title fix(site/src): show chat instead of side panels on small viewports fix(site/src): show chat instead of the right panel on small viewports Aug 20, 2026
@bpmct
bpmct marked this pull request as ready for review August 20, 2026 18:16
@bpmct
bpmct requested a review from DanielleMaywood as a code owner August 20, 2026 18:16
@ibetitsmike

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c136525cdb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/AgentsPage/AgentChatPage.stories.tsx
Comment thread site/src/pages/AgentsPage/AgentChatPage.test.ts Outdated
@linear-code

linear-code Bot commented Aug 20, 2026

Copy link
Copy Markdown

CODAGT-958

Exercise the explicit panel toggle in the narrow-viewport story so a
clearSuppression regression fails the interaction test, and type the
matchMedia mock with satisfies so DOM signature drift is caught.
@ibetitsmike

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d644928f11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/hooks/useIsBelowLgViewport.ts Outdated
…pers

Derive one canonical showSidebarPanel value from the persisted
preference and the narrow suppression, narrow the setter to a plain
boolean so the raw-vs-effective updater bug cannot be reintroduced,
share the media-query subscription between breakpoint hooks, and
extract a reusable matchMedia test helper.
@ibetitsmike

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e77b9b1b16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/AgentsPage/AgentChatPage.tsx
…essed

Gate visualExpanded and the RightPanel isExpanded prop on the panel
being shown, so a panel expanded on a wide viewport no longer covers
chat after the window narrows (or after an explicit close). The shared
matchMedia stub now delegates unconfigured queries to the real
implementation so story environments keep truthful responsive behavior,
and a story covers expand-then-narrow via a simulated breakpoint
crossing.
@ibetitsmike

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: f5f0615750

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the fix and drove it through the Codex review loop: three rounds of findings fixed (interaction coverage for the panel toggle, typed matchMedia mock, shared media-query subscription, and gating the expanded panel on suppression, proven red-green), with a clean Codex verdict on f5f0615 and all checks green.

Shux acted on Mike's (@ibetitsmike) behalf.

@ibetitsmike
ibetitsmike merged commit bb7f2f2 into main Aug 20, 2026
26 checks passed
@ibetitsmike
ibetitsmike deleted the fix/task-page-mobile-sidebar branch August 20, 2026 19:55
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants