Repository navigation
Conversation
Co-authored-by: LukasTy <[email protected]>
…ameter Co-authored-by: LukasTy <[email protected]>
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@copilot, I have updated the tests to fail in certain condition. Update the solution so it behaves the same regardless of the tab change method. |
…ternal value changes Co-authored-by: LukasTy <[email protected]>
|
@LukasTy – Any idea when you'll be able to return to this PR? 🙏 |
Codex ReviewOverviewThis patch moves activation-direction handling into Findings1. 🔴 [Blocking] Horizontal controlled updates still expose
|
| Bundle | Parsed size | Gzip size |
|---|---|---|
@base-ui/react |
+348B (+0.07%) |
+99B (+0.07%) |
Recommendation: Collapse both paths onto one shared direction-calculation helper instead of keeping a DOM-based click path and a separate index-based controlled path. That should simplify the patch, reduce drift risk, and likely recover most or all of the added bytes. If the root-side branch stays, it also needs explicit RTL/visual-order regression coverage.
Confidence: 4/5
I reviewed the full branch diff, did the required second-pass sweep across correctness/accessibility/API/maintainability/perf/test coverage, checked the PR’s bundle-size report, and ran the targeted TabsRoot suites in both JSDOM and Chromium. The remaining uncertainty is around edge-case layouts that are not yet covered by automated tests.
Notes
The JSDOM TabsRoot suite passes on this branch; the Chromium TabsRoot suite is the one that exposes the blocking regression above.
|
@atomiks I've addressed the changes. If we want to keep the DOM-based solution for clicks, then I'm not sure if there is a clean way to handle the programmatic updates without a separate solution path (bigger bundle). |
Codex ReviewOverviewThis revision simplifies the fix by moving click and programmatic updates onto one shared activation-direction calculation, and it also reduces bundle size versus Findings1. 🔴 [Blocking] Click direction is now wrong when tabs are visually reordered with CSSImpact: Base UI is headless, so consumers can legitimately reorder tabs with CSS ( Evidence: Recommendation: Keep the shared programmatic path if you want the smaller patch, but do not replace the click path with an index-based calculation. Either preserve the previous DOM-position-based logic for user clicks or feed the shared helper with rendered positions rather than composite indices. 2. 🟡 [Non-blocking] The test update drops RTL keyboard coverage in ChromiumImpact: The branch still contains RTL-specific behavior, but the updated tests no longer execute the RTL keyboard block in any environment. That makes the new direction logic easier to regress without the suite noticing. Evidence: Recommendation: Restore the old conditional (or another browser-capable equivalent) so the RTL keyboard cases still run in Chromium. Since this patch now centralizes direction logic, it would also be worth adding at least one controlled-value activation-direction assertion under Confidence: 4/5I reviewed the full NotesThe earlier render-prop issue looks resolved on the current head: both |
|
Closing in favor of: #4347. |
data-activation-directionattribute only updated when clicking tabs directly. Programmatic value changes in controlled mode left the attribute stale, breaking CSS animations that depend on direction.Changes
computeActivationDirection()function determines direction by comparing tab indices (instead of DOM pixel positions). Direction is computed both during render (for external value changes) and inonValueChange(for click/keyboard). ApreviousValueRef+ layout effect tracks the prior value.useActivationDirectionDetectorhook and getInset helper (~89 lines) that relied ongetBoundingClientRectand only worked for click-triggered changes.data-activation-directionattribute and render callback state. Vertical test is restricted to Chromium (it.skipIf(isJSDOM)).Before/After
Before:
data-activation-directionstays"none"After:
data-activation-directionupdates to"right"(or"left","up","down"based on direction)Fixed StackBlitz example: https://stackblitz.com/edit/vitejs-vite-htowv2m8?file=src%2FApp.tsx
Note
Initially tried playing with Copilot to fix this, but ended up finishing locally with manual changes, a bit of Copilot and mostly Claude fine-tuning it.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.4/linux64/chrome-headless-shell-linux64.zip/home/REDACTED/.nvm/versions/node/v22.22.0/bin/node /home/REDACTED/.nvm/versions/node/v22.22.0/bin/node /home/REDACTED/work/base-ui/base-ui/node_modules/.pnpm/[email protected]/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js(http block)https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.4/linux64/chrome-linux64.zip/home/REDACTED/.nvm/versions/node/v22.22.0/bin/node /home/REDACTED/.nvm/versions/node/v22.22.0/bin/node /home/REDACTED/work/base-ui/base-ui/node_modules/.pnpm/[email protected]/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js(http block)iojs.org/usr/bin/curl curl -q --fail --compressed -L -s REDACTED -o -(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.