You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When content under a resting pointer is removed and a collapsed Markdown details block shifts under it (for example, when an expanded section above it collapses), clicking its summary ignores the first click and leaves the block closed instead of opening it.
MarkdownDetails renders a placeholder <button> until armed, so closed blocks skip mounting Base UI Collapsible. React runs no onPointerEnter for that shift (Chromium's pointerover names an ancestor as relatedTarget and sends no pointerout), so pressing focuses the placeholder, onFocus runs flushSync(() => setArmed("focus")), and the placeholder is replaced between mousedown and mouseup, so no click reaches either button.
Change
In apps/web/src/components/chat/MarkdownDetails.tsx, arm on focus only for keyboard focus (:focus-visible), and preserve focus on CollapsibleTrigger via armMode whenever onPointerEnter or onClick swaps a focused placeholder button. Add a Chromium browser regression test in apps/web/src/components/ChatMarkdown.browser.test.tsx.
Scope
Bug fix (a control that does nothing on first click). One source file plus its browser test for an obvious DOM bug; no prior issue required. Lazy Base UI mounting, hover/touch pointerenter arming, and keyboard Tab/Enter arming remain intact.
Verification
Setup: Linux (Ubuntu 26.04 x86_64), T3 Code web dev app in Chromium (Browser panel), light theme, 1280×800, fresh isolated state on each commit.
Steps: Open notes.md (expanded First section, collapsed Second section) in rendered Markdown view → rest pointer over First section body → Tab to First section and press Enter so Second section shifts under the resting pointer → left-click once without moving the pointer.
Electron desktop (wraps apps/web; verified in Chromium in Browser panel).
iOS/Android mobile (native fold renderer; unaffected).
Automated checks (base fail, head pass, and check:changed)
Base 45e875bef542 (vp test run apps/web/src/components/ChatMarkdown.browser.test.tsx -t "ChatMarkdown details"):
FAIL |@t3tools/web (browser) (chromium)| src/components/ChatMarkdown.browser.test.tsx > ChatMarkdown details > opens collapsed details on the first click after shifting under a resting pointer
VitestBrowserElementError: Cannot find element with locator: locator('div').nth(1).getByText('Hidden two')
Test Files 1 failed (1)
Tests 1 failed | 1 passed | 70 skipped (72)
Head e4df9d0008de (vp run check:changed 45e875bef54238ff73394003e39138d7a63b1370):
…the first click
When content under a resting pointer is removed and a collapsed Markdown details block shifts under it, pressing focuses the placeholder button and onFocus synchronously swaps it for Base UI's trigger before mouseup, so no click reaches either button. Guard onFocus with :focus-visible and preserve focus via armMode when swapping the placeholder, leaving hover and touch pointerenter arming intact.
Macroscope's review found this PR approvable — Updates Markdown details controls to open on the first click after moving beneath a stationary pointer, while retaining focus handling. The change is limited to local UI interaction and preserves existing disclosure defaults.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between e4df9d0 and 6499e8f.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Disclosure arming now selects focus or hover based on the active element. Focus events arm only when the placeholder matches :focus-visible. A browser test covers clicking a second disclosure while the pointer remains stationary.
Changes: Disclosure arming
Layer / File(s)
Summary
Arming behavior and regression test apps/web/src/components/chat/MarkdownDetails.tsx, apps/web/src/components/ChatMarkdown.browser.test.tsx
Pointer entry and clicks choose focus or hover based on the active element. Focus arms only when the placeholder matches :focus-visible. The browser test verifies that the second disclosure opens and retains focus after the first closes.
This fixes the first-click failure on Markdown disclosure blocks. The change is small and covered by a browser regression test. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual change: a Markdown details block that shifts under a resting pointer no longer needs a second click to open. It follows the conventional commit form and matches the raw summ…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the symptom, the trigger, and the root cause. The Change section names the fil…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the actual change: a Markdown details block that shifts under a resting pointer no longer needs a second click to open. It follows the conventional commit form and matches the raw summary, which covers the MarkdownDetails arming logic and the browser regression test. It is slightly long at 84 characters, but it is specific and not vague.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the symptom, the trigger, and the root cause. The Change section names the file and the arming behavior. The Scope section gives the reason no issue is linked. The Verification section lists base-fail and head-pass browser test results, check:changed results, and manual Chromium steps with before/after screenshots. Gaps: the Scope section does not link an issue or a maintainer request, and it says no prior issue was required without a reason tied to the template's 'obvious bug' rule. The Change section also does not explain why the change spans only one component. The description also ends with the model and harness line, which the template asks for. The 'Not shown' list records what was not checked. Overall the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Environment: real web app, headless Chromium 156 on Linux, 1280×800, light theme; fresh isolated databases, synthetic files and Replay (dev) thread on each commit.
Steps: In notes.md, render an expanded First section with four body paragraphs followed by a collapsed Second section. Park the pointer over First's body at the measured position where Second's summary will land. Focus the preceding toolbar button, press Tab then Enter to collapse First, and send mouse down/up at the unchanged pointer position. Capture the first-click result and check that Hidden second body. is visible and Second section owns focus.
Scenario: Details moved under a resting pointer open on the first click
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When content under a resting pointer is removed and a collapsed Markdown details block shifts under it (for example, when an expanded section above it collapses), clicking its summary ignores the first click and leaves the block closed instead of opening it.
MarkdownDetailsrenders a placeholder<button>until armed, so closed blocks skip mounting Base UICollapsible. React runs noonPointerEnterfor that shift (Chromium'spointerovernames an ancestor asrelatedTargetand sends nopointerout), so pressing focuses the placeholder,onFocusrunsflushSync(() => setArmed("focus")), and the placeholder is replaced betweenmousedownandmouseup, so noclickreaches either button.Change
In
apps/web/src/components/chat/MarkdownDetails.tsx, arm onfocusonly for keyboard focus (:focus-visible), and preserve focus onCollapsibleTriggerviaarmModewheneveronPointerEnteroronClickswaps a focused placeholder button. Add a Chromium browser regression test inapps/web/src/components/ChatMarkdown.browser.test.tsx.Scope
Bug fix (a control that does nothing on first click). One source file plus its browser test for an obvious DOM bug; no prior issue required. Lazy Base UI mounting, hover/touch
pointerenterarming, and keyboardTab/Enterarming remain intact.Verification
Setup: Linux (Ubuntu 26.04 x86_64), T3 Code web dev app in Chromium (Browser panel), light theme, 1280×800, fresh isolated state on each commit.
Steps: Open
notes.md(expandedFirst section, collapsedSecond section) in rendered Markdown view → rest pointer overFirst sectionbody →TabtoFirst sectionand pressEntersoSecond sectionshifts under the resting pointer → left-click once without moving the pointer.45e875bef542)e4df9d0008de)Second section stays collapsed after first click
Second section opens on first click
Links:
apps/web/src/components/ChatMarkdown.browser.test.tsx(ChatMarkdown details)Not shown:
apps/web; verified in Chromium in Browser panel).Automated checks (base fail, head pass, and check:changed)
Base
45e875bef542(vp test run apps/web/src/components/ChatMarkdown.browser.test.tsx -t "ChatMarkdown details"):Head
e4df9d0008de(vp run check:changed 45e875bef54238ff73394003e39138d7a63b1370):Generated with Gemini 4 Neon in T3 Code Nightly