Skip to content

Web GUI: make tabs that don't fit (like Charts) easy to reach - #12082

Merged
maliberty merged 9 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix-WebGUI-tab-overflow
Nov 13, 2026
Merged

maliberty merged 9 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix-WebGUI-tab-overflow

Conversation

@jorge-ferreira-pii

@jorge-ferreira-pii jorge-ferreira-pii commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #11892.

When a panel has more tabs than it can show, the hidden ones (Charts, for example) could only be reached by enlarging the panel, which hid the design.

  • A small ▼ button on every panel lists its tabs; picking one opens it.
  • The tab strip fades at its right edge, and the mouse wheel scrolls through the tabs.
  • An enlarged panel shows a clear "Restore layout" button.
  • Opening a window from the Windows menu brings back the normal layout if an enlarged panel was hiding it. Showing a timing cone in the schematic does the same.
  • Schematic is now listed in the Windows menu, so it can be reopened after being closed.
  • In Timing, a timing cone can start from a step picked in the path list, and the schematic keeps showing it when refreshed.
  • The tab list works from the keyboard: arrow keys, the first letter of a tab, and Esc to close.

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@github-actions

Copy link
Copy Markdown
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a tab overflow management system for the IDE layout manager, including horizontal scrolling of tabs via vertical wheel events, an overflow dropdown menu listing all tabs, and a reveal option to restore maximized panes when focusing a hidden component. The feedback suggests making the exported wheelDeltaPx utility backward-compatible to prevent runtime errors in external callers, and adding an early return in _onMenuKey to avoid division-by-zero (NaN) errors when the tab menu is empty.

Comment thread src/web/src/ui-utils.js
Comment on lines +694 to 703
export function wheelDeltaPx(e, pagePx) {
const kLineHeightPx = 16;
let scale = 1;
if (e.deltaMode === 1) {
scale = kLineHeightPx;
} else if (e.deltaMode === 2) {
scale = container.clientHeight || kLineHeightPx;
scale = pagePx() || kLineHeightPx;
}
return [e.deltaX * scale, e.deltaY * scale];
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The signature of wheelDeltaPx has been changed from accepting a DOM element (container) to a function (pagePx). Since wheelDeltaPx is an exported utility function, this breaking change could cause runtime errors (TypeError: pagePx is not a function) if other modules or external plugins call it using the old signature. Making it backward-compatible by checking the type of pagePx ensures robustness and prevents crashes.

Suggested change
export function wheelDeltaPx(e, pagePx) {
const kLineHeightPx = 16;
let scale = 1;
if (e.deltaMode === 1) {
scale = kLineHeightPx;
} else if (e.deltaMode === 2) {
scale = container.clientHeight || kLineHeightPx;
scale = pagePx() || kLineHeightPx;
}
return [e.deltaX * scale, e.deltaY * scale];
}
export function wheelDeltaPx(e, pagePx) {
const kLineHeightPx = 16;
let scale = 1;
if (e.deltaMode === 1) {
scale = kLineHeightPx;
} else if (e.deltaMode === 2) {
scale = (typeof pagePx === 'function' ? pagePx() : pagePx?.clientHeight) || kLineHeightPx;
}
return [e.deltaX * scale, e.deltaY * scale];
}

Comment on lines +435 to +457
_onMenuKey(e) {
const menu = this.renderRoot.querySelector('.ide-tab-menu');
if (!menu || !e.composedPath().includes(menu)) return;
const items = [...menu.querySelectorAll('.ide-tab-menu-item')];
const n = items.length;
const i = items.indexOf(this.renderRoot.activeElement);
let target = null;
if (e.key === 'ArrowDown') {
target = items[(i + 1) % n];
} else if (e.key === 'ArrowUp') {
target = items[i <= 0 ? n - 1 : i - 1];
} else if (e.key === 'Home') {
target = items[0];
} else if (e.key === 'End') {
target = items[n - 1];
} else if (e.key.length === 1 && e.key !== ' ' && !e.ctrlKey && !e.metaKey && !e.altKey) {
// Type-ahead: the next item whose title starts with the letter.
const letter = e.key.toLowerCase();
target = [...items.slice(i + 1), ...items.slice(0, i + 1)].find(item =>
item.querySelector('.ide-tab-menu-title').textContent.toLowerCase().startsWith(letter));
} else if (e.key !== 'Escape') {
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To prevent potential runtime errors and division-by-zero (NaN) issues when navigating the menu via keyboard shortcuts, we should add an early return if the menu contains no items. Additionally, using optional chaining when querying the .ide-tab-menu-title element adds extra robustness in case the DOM structure of the menu item is ever customized or modified.

    _onMenuKey(e) {
        const menu = this.renderRoot.querySelector('.ide-tab-menu');
        if (!menu || !e.composedPath().includes(menu)) return;
        const items = [...menu.querySelectorAll('.ide-tab-menu-item')];
        const n = items.length;
        if (n === 0) return;
        const i = items.indexOf(this.renderRoot.activeElement);
        let target = null;
        if (e.key === 'ArrowDown') {
            target = items[(i + 1) % n];
        } else if (e.key === 'ArrowUp') {
            target = items[i <= 0 ? n - 1 : i - 1];
        } else if (e.key === 'Home') {
            target = items[0];
        } else if (e.key === 'End') {
            target = items[n - 1];
        } else if (e.key.length === 1 && e.key !== ' ' && !e.ctrlKey && !e.metaKey && !e.altKey) {
            // Type-ahead: the next item whose title starts with the letter.
            const letter = e.key.toLowerCase();
            target = [...items.slice(i + 1), ...items.slice(0, i + 1)].find(item =>
                item.querySelector('.ide-tab-menu-title')?.textContent?.toLowerCase().startsWith(letter));
        } else if (e.key !== 'Escape') {
            return;
        }

@jorge-ferreira-pii
jorge-ferreira-pii marked this pull request as ready for review October 30, 2026 21:31
@jorge-ferreira-pii
jorge-ferreira-pii requested a review from a team as a code owner October 30, 2026 21:31
@QuantamHD

Copy link
Copy Markdown
Collaborator

@jorge-ferreira-pii The code that's been written to keep track of tabs that are overflowing is extremely complicated. IMO it's not worth the extra code to track such things.

We should just put a constant ▼ button on every pan to allow users to click it, and remove the dynamic nature of the fading gradient. That should remove a large amount of code in the grid.js file

Comment thread src/web/src/grid-layout.js Outdated
Comment on lines +394 to +396
const inside = ['.ide-tab-menu', '.ide-btn-overflow'].some(
sel => path.includes(this.renderRoot.querySelector(sel)));
if (!inside) this._closeMenu();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In lit and other reactive libraries you shouldn't use css selectors to store state. All state should be tracked by reactive elements, and then in the render you should apply the css labels you want.

This removes the need for you to track two sets of state inside your app.

@jorge-ferreira-pii
jorge-ferreira-pii marked this pull request as draft October 31, 2026 00:04
Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…flow

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>

# Conflicts:
#	src/web/dist/app.min.js
#	src/web/dist/report.min.js
@github-actions github-actions Bot added size/L and removed size/XL labels Nov 3, 2026
@jorge-ferreira-pii

Copy link
Copy Markdown
Contributor Author

@jorge-ferreira-pii The code that's been written to keep track of tabs that are overflowing is extremely complicated. IMO it's not worth the extra code to track such things.

We should just put a constant ▼ button on every pan to allow users to click it, and remove the dynamic nature of the fading gradient. That should remove a large amount of code in the grid.js file

Thanks, I did in the latest commit:

  • A constant ▼ tab menu button on every pane, whether or not the tabs fit.
  • The fade is now a fixed CSS gradient on the strip's right edge; no JavaScript tracks it.
  • All overflow tracking is gone (ResizeObserver, overflow/fade state, the inner track).
  • Following your inline comment, the pane keeps its state in reactive properties and Lit refs instead of looking elements up by CSS selector; focus in the menu follows a reactive index.

One note: in the bottom pane, the new ▼ sits next to the console's collapse ▼; their tooltips differ ("List all tabs" / "Collapse Console"). Happy to change either icon if you prefer.

@jorge-ferreira-pii
jorge-ferreira-pii marked this pull request as ready for review November 3, 2026 23:35
…flow

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>

# Conflicts:
#	src/web/src/timing-widget.js
#	src/web/test/js/test-timing-widget.js
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>

# Conflicts:
#	src/web/src/schematic-widget.js
#	src/web/src/timing-widget.js
#	src/web/test/js/test-timing-widget.js
…Back

Double-click expansion and Back changed the view without updating the
instance Refresh redraws, so Refresh jumped back to an older cone.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Splitting the pin name at its last '/' read a 3DBlox chiplet port
(chip/port) as a pin of instance 'chip', so Cone synced the schematic
to an instance that does not exist. The report already sends each
node's instance.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
When the tab strip overflows and is scrolled to its end, the right-edge
fade covered the last tab's close button; end padding lets it scroll
clear. A pane with every tab closed opened an empty tab menu, so its
button is disabled until a tab opens.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@github-actions github-actions Bot added size/XL and removed size/L labels Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@maliberty
maliberty merged commit 7b7a975 into The-OpenROAD-Project:master Nov 13, 2026
19 of 20 checks passed
@maliberty
maliberty deleted the fix-WebGUI-tab-overflow branch November 13, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it easier to find "Charts" in web GUI

3 participants