[mirror] fix: resolve outsideBox style for tabs#2
Open
yashwant86 wants to merge 8 commits intomm-base-24561from
Open
[mirror] fix: resolve outsideBox style for tabs#2yashwant86 wants to merge 8 commits intomm-base-24561from
outsideBox style for tabs#2yashwant86 wants to merge 8 commits intomm-base-24561from
Conversation
The initial recalculation used container.clientWidth (which includes padding), while ResizeObserver reports entry.contentRect.width (which excludes padding). When the tab list has horizontal padding (e.g. px-4 on AgentRow), this mismatch can cause tab visibility to oscillate near breakpoint widths. Use a content-box width helper to keep both paths consistent.
- Use vi.stubGlobal for ResizeObserver mock instead of direct globalThis assignment. - Await act() calls in test cases.
⚡ Risk Assessment —
|
| Files | Summary |
|---|---|
Tabs Component Styling & Layoutsite/src/components/Tabs/Tabs.tsxsite/src/modules/resources/AgentRow.tsx |
Fixes outsideBox variant styling by reducing trigger padding from py-3 to py-2.5, adding -mb-px negative margin, and updating TabsList variant from insideBox to outsideBox with proper padding. Aligns kebab menu trigger styling with tab triggers. |
Tab Overflow Calculation Logicsite/src/components/Tabs/utils/useKebabMenu.ts |
Rewrites tab overflow calculation to account for columnGap spacing between tabs. Replaces complex reduce-based algorithm with direct loop. Adds getContentBoxWidth and getTabGap helpers. Switches from useEffect to useLayoutEffect for immediate recalculation. Adds tabs to dependency array. |
Tab Overflow Test Suitesite/src/components/Tabs/utils/useKebabMenu.test.tsx |
Adds comprehensive test suite for useKebabMenu hook with MockResizeObserver. Tests tab visibility with sufficient width and verifies gap spacing is correctly accounted for when determining overflow. |
AgentRow Log Tabs UIsite/src/modules/resources/AgentRow.tsx |
Adds PackageIcon to All Logs tab. Restructures log tabs container to move ref and className to TabsList. Updates kebab menu trigger className to match TabsTrigger styling pattern. |
Sequence Diagram
sequenceDiagram
participant User
participant AgentRow
participant TabsList
participant useKebabMenu
participant ResizeObserver
User->>AgentRow: View logs
AgentRow->>TabsList: Render with outsideBox variant
TabsList->>useKebabMenu: Initialize with tabs
useKebabMenu->>ResizeObserver: Observe container width
ResizeObserver->>useKebabMenu: Report contentRect.width
useKebabMenu->>useKebabMenu: Calculate visible tabs (accounting for gap)
useKebabMenu->>TabsList: Update visibleTabs & overflowTabs
TabsList->>User: Render visible tabs + kebab menu
Dig Deeper With Commands
/review <file-path> <function-optional>/chat <file-path> "<question>"/roast <file-path>
Runs only when explicitly triggered.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Mirror of upstream coder#24561 for benchmark. Do not merge.
Summary by MergeMonkey