Skip to content

Keep keyboard focus in the child question banner - #5424

Merged
brsbl merged 14 commits into
bb/child-threads-4b-answer-in-banner-thr_7xmbr7vsqzfrom
bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz
Oct 14, 2026
Merged

brsbl merged 14 commits into
bb/child-threads-4b-answer-in-banner-thr_7xmbr7vsqzfrom
bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz

Conversation

@brsbl

@brsbl brsbl commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Opening or answering a question in the banner dropped keyboard focus to the page, so the next Tab started from the top.

What changed

  • Opening a question moves focus to "‹ Active child threads", or to the title link for one child.
  • Back, Esc, and Cancel return focus to that child's row in the same banner.
  • After an answer, focus returns to the banner if it was there.
  • Focus in another pane is left alone.

How you verified

  • Remote CI on bba2ed6362: pending.
  • New tests cover each focus return, the own-banner row lookup, and focus left outside.
  • Dev app on 67fac0a81f: answering in another pane left focus there.
  • Dev app on the stack top (82cb2a1812, Chrome for Testing 155): Enter on a row focused the title link, and Cancel returned focus to the row.
  • The first screenshot row predates the header change; questions now open from a row.

Screenshots

Before: 49bb0dec3c · After: 470852f795 · Captured at 2× · The red box marks keyboard focus; before, focus is on the page.

Screen / state Viewport Before After
Open a question from the collapsed header with the keyboard Desktop · 1280×720 Before: focus lost after opening After: focus on Active child threads
Submit an answer with the keyboard Desktop · 1280×720 Before: focus lost after answering After: focus back on Active child threads

BB-Thread-ID: thr_p3h5vu5u4j
BB-Thread: Redesign child threads

🤖 Generated with Claude Code

AGENT GENERATED

Opening a question from a row or the collapsed header moves focus to
"‹ Active child threads" (or the title link when there is one child).
Back and Esc return focus to that child's row in the same banner. When
an answered question leaves and focus had been inside the banner,
focus returns to the banner instead of dropping to the page; focus
elsewhere, such as another pane, is left alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brsbl
brsbl added this pull request to stack #5425 October 13, 2026 08:56
@brsbl
brsbl marked this pull request as ready for review October 13, 2026 09:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T09:12:56.309861Z 470852f Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 470852f795

ℹ️ 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 on lines +971 to +975
useEffect(() => {
if (openChildThreadId !== null && focusBackOnOpen.current) {
focusBackOnOpen.current = false;
(backButtonRef.current ?? titleLinkRef.current)?.focus();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve focus when the back header changes

In the live ThreadDetailView flow, items is recomputed as child runtimes change, so while a question remains open the count can cross between one and multiple children. After this effect focuses the back button, such a change flips showBackHeader and replaces ChildQuestionBackHeader with the separate disclosure button (or vice versa), unmounting the focused element. Because currentInteractionId did not change, the later restoration effect returns early and focus falls to the page. Keep the header focus target mounted across this transition or explicitly hand focus to the replacement.

Useful? React with 👍 / 👎.

brsbl added 2 commits October 13, 2026 02:13
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz

# Conflicts:
#	apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.tsx
brsbl and others added 11 commits October 13, 2026 02:53
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz

# Conflicts:
#	apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.child-questions.test.tsx
#	apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.tsx
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz

# Conflicts:
#	apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.tsx
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz

# Conflicts:
#	apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.child-questions.test.tsx
#	apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.tsx
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz

# Conflicts:
#	apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.tsx
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz
…to bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz
@brsbl
brsbl merged commit 58c496f into main Oct 14, 2026
28 checks passed
@brsbl
brsbl deleted the bb/child-threads-4c-banner-focus-thr_7xmbr7vsqz branch October 14, 2026 18:42
brsbl added a commit that referenced this pull request Oct 14, 2026
## Human comments

## What was wrong

Child questions could only be answered in separate cards above the
composer, so the banner listed questions you couldn't act on there.

## What changed

- Clicking a waiting child opens its question inside the banner.
- Clicking the collapsed header only expands the list.
- With more than one child, "‹ Active child threads" or Esc returns to
the list.
- "‹ 1 of n ›" steps between waiting questions, and answering moves to
the next.
- Cancel returns to the list and leaves the question waiting.
- The open "child: question" line matches the list's 12px size.
- A long question shows five lines, then scrolls.
- Esc keeps the question open during text composition or when the form
handled it.
- Question cards above the composer still show in this layer; merge with
#5424 and #5391.

## How you verified

- Remote CI on `4c7677b80b`: pending.
- New tests check that answers reach the open child and the open form
skips unrelated re-renders.
- Dev app on `cf39a34051`: a long question and long labels fit a 390px
screen.
- Dev app on the stack top (`82cb2a1812`, Chrome for Testing 155): the
header click expanded the list without opening a question.
- Dev app on the stack top (`82cb2a1812`, Chrome for Testing 155):
Cancel kept the child waiting, and answering resolved it.

### Screenshots

Before: `bdcec0c109` · After: `49bb0dec3c` · Long-question row: before
`0a20c99c5b`, after `da23883d86` · Open question line: before
`921c407d42`, after `7a7044dda3` · Captured at 2×

| Screen / state | Viewport | Before | After |
| --- | --- | --- | --- |
| Question opened in the banner | Desktop · 1280×720 | ![Before: waiting
list, rows open the child
thread](https://github.com/user-attachments/assets/b0a5de4c-1a6e-4926-9bf3-aeec424f6587)
| ![After: question opened in the
banner](https://github.com/user-attachments/assets/3044d922-b7d1-4445-9c72-0c9e45fa8d81)
|
| Question opened in the banner | Mobile · 390×844 | ![Before: waiting
list on
mobile](https://github.com/user-attachments/assets/55c88734-cb24-482e-9219-edbe79a7cff4)
| ![After: question opened in the banner on
mobile](https://github.com/user-attachments/assets/860f7aa1-c898-4343-9a06-cd21dc273372)
|
| Step to the next waiting question | Desktop · 1280×720 | ![Before: no
stepper](https://github.com/user-attachments/assets/94c15f39-fac9-4afd-9b8f-dee705b792e5)
| ![After: second question, 2 of
2](https://github.com/user-attachments/assets/a3c8231e-7dcc-42c5-b93c-eb8a4434d257)
|
| Single child: question opened | Desktop · 1280×720 | ![Before: single
child
waiting](https://github.com/user-attachments/assets/7207199d-0f8e-47e3-a943-e1051b646c00)
| ![After: single child's question
opened](https://github.com/user-attachments/assets/45a40d61-4cbb-4228-ba63-495b6e550536)
|
| Open question line matches the list | Desktop · 1100×800 | ![Before:
open question line at
13px](https://github.com/user-attachments/assets/9bf99322-8ca1-44a2-9616-44046ef0b7f7)
| ![After: open question line at
12px](https://github.com/user-attachments/assets/b2e4eba4-4bcf-412f-8fdc-89e4b136c572)
|
| Open question line matches the list | Mobile · 390×844 | ![Before:
open question line on
mobile](https://github.com/user-attachments/assets/0015d909-06ce-48ef-bc11-2b4fa106e0eb)
| ![After: open question line on
mobile](https://github.com/user-attachments/assets/e6098684-84fd-44e2-b225-0363a7e7d4f7)
|
| Long question with a long option label | Mobile · 390×844 | ![Before:
long question in its own
card](https://github.com/user-attachments/assets/0ff1c77f-7d15-4093-a5bc-b78a9ca3ca90)
| ![After: question capped at five lines, label
wrapped](https://github.com/user-attachments/assets/62aa29bf-f59e-4b12-a3dd-40211f47a16b)
|

BB-Thread-ID: thr_p3h5vu5u4j
BB-Thread: [Redesign child
threads](https://brsbl.getbb.app/projects/proj_khiw2za95v/threads/thr_7xmbr7vsqz)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant