Skip to content

Commit

Permalink
LibWebView: Prevent displaying two scroll bars in the inspector console
Browse files Browse the repository at this point in the history
We currently display scroll bars for the JS console and its parent tab
container. We want the console output to be separately scrollable from
the tab content, but since both containers are scrollable, we end up
with nested scroll bars. This also makes actually scrolling feel pretty
awkward.

Prevent this by making the tab container non-scrollable when the JS
console is shown.

(cherry picked from commit 4795b9206cfeb2edf573461e02f0c148b9972a36)
  • Loading branch information
trflynn89 authored and nico committed Jul 22, 2024
1 parent 098a2ad commit 2bec427
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Base/res/ladybird/inspector.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ body {
border-radius: 0.5rem;

margin-top: 30px;
padding: 8px;
padding: 8px 0px 0px 4px;
}

@media (prefers-color-scheme: dark) {
Expand Down
9 changes: 9 additions & 0 deletions Base/res/ladybird/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ const selectTopTab = (tabButton, tabID) => {
const selectBottomTab = (tabButton, tabID) => {
selectedBottomTab = selectTab(tabButton, tabID, selectedBottomTab, selectedBottomTabButton);
selectedBottomTabButton = tabButton;

let inspectorBottom = document.getElementById("inspector-bottom");
inspectorBottom.scrollTo(0, 0);

if (tabID === "console") {
inspectorBottom.style.overflow = "hidden";
} else {
inspectorBottom.style.overflow = "scroll";
}
};

let initialTopTabButton = document.getElementById("dom-tree-button");
Expand Down

0 comments on commit 2bec427

Please sign in to comment.