Skip to content

bug(trace-viewer): Overflow with TabbedPane Component #36251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Zemotacqy
Copy link
Contributor

Closes: #33930

  • TabbedPane component now supports overflowMode param that automatically renders elements to a dropdown upon container resize.
  • This is a generic component that can be applied all other UIElements where TabbedPane is used. Ex: workbench sidebar as well, making the whole view responsive.

Before:

before.mp4

After:

after.mp4

This comment has been minimized.

@dgozman dgozman requested a review from agg23 June 10, 2025 12:58
@Zemotacqy
Copy link
Contributor Author

Hey @agg23 , Did you get a chance to review this PR?
Thanks in advance!!

@Zemotacqy
Copy link
Contributor Author

Hey @agg23 , Requesting for a review.

Copy link
Contributor

@agg23 agg23 left a comment

Choose a reason for hiding this comment

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

Thank you for looking into this (and particularly for creating a test). I am worried that there's a lot of complicated UI code here; we would generally prefer this to be as minimal as possible.

Additionally, it would be nice if the test validated the resize mechanics (the select changing based on available space).

@@ -77,6 +76,7 @@

.tab-network .tabbed-pane-tab.selected {
font-weight: bold;
background-color: var(--vscode-list-inactiveSelectionBackground) !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is !important required? If necessary, the reason should be documented, but I think it's probably not necessary.

Copy link
Contributor Author

@Zemotacqy Zemotacqy Jul 1, 2025

Choose a reason for hiding this comment

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

Now, that we started using TabbedPane component. So, style:

.tabbed-pane-tab.selected {
background-color: var(--vscode-tab-activeBackground);
}
was overriding styles in networkFilters.css.

Which was a white background selection instead of blue background on selection.

So, to honour the blue background selection, added this important here. This style gets applied only on network tab selection on hover.

Seems necessary. Based on the reasoning, do you think I should add a comment?

{resourceType}
</div>
))}
<TabbedPane
Copy link
Contributor

Choose a reason for hiding this comment

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

What about other places that use TabbedPane? Do they upgrade to the new functionality for free?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I experimented with another component where this worked like a charm. Reference commit: Zemotacqy@8df5e25

const [visibleTabs, setVisibleTabs] = React.useState<TabbedPaneTabModel[]>(mode !== 'select' ? tabs : []);
const [overflowTabs, setOverflowTabs] = React.useState<TabbedPaneTabModel[]>(mode === 'select' ? tabs : []);
const [tabWidths, setTabWidths] = React.useState<Record<string, number>>({});
const [, setContainerWidth] = React.useState<number>(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using this for rerender management? Why does it matter, given you're also setting other state every time this is set? Those other sets will always be new/unique as well, so they will also cause a rerender.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @agg23 , This makes sense. I verified, containerWidth wasn't to re-render other states. It was only used for calculation of available space. Have pushed a commit to remove it usage.

onSelect={setSelectedTab}
/>)),
]}
{visibleTabs.length > 0 && <div style={{ flex: 'auto', display: 'flex', height: '100%', overflow: 'hidden' }} role='tablist'>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does mode continue to work in the same way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. mode continues to work in the same way because by default every tab is set as visible tab here:

const [visibleTabs, setVisibleTabs] = React.useState<TabbedPaneTabModel[]>(mode !== 'select' ? tabs : []);
const [overflowTabs, setOverflowTabs] = React.useState<TabbedPaneTabModel[]>(mode === 'select' ? tabs : []);

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Jul 1, 2025

Test results for "tests 1"

6 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1087:7 › cli codegen record › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
⚠️ [firefox-library] › library/inspector/cli-codegen-aria.spec.ts:76:7 › should update aria snapshot highlight @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node22-1
⚠️ [chromium] › headerView.spec.tsx:46:1 › should toggle filters @web-components-html-reporter
⚠️ [webkit-page] › page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

47041 passed, 979 skipped
✔️✔️✔️

Merge workflow run.

@Zemotacqy Zemotacqy requested a review from agg23 July 1, 2025 11:52
@agg23
Copy link
Contributor

agg23 commented Jul 2, 2025

This is a lot more code that we are comfortable with for such a small feature improvement. Due to the size of our team, we need to optimize heavily for efficiency. Unfortunately that means we are closing this issue for triage.

@agg23 agg23 closed this Jul 2, 2025
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.

[Bug]: Docking UI Mode control panel to right side defaults to bad truncation of text
2 participants