Skip to content

Commit ccbce24

Browse files
committed
fix: hide per-line scrollbars of unwrapped code blocks in editing mode
Chromium ignores ::-webkit-scrollbar styles when scrollbar-color or scrollbar-width is not auto. Obsidian sets scrollbar-color on body:not(.styled-scrollbars), which every line inherits, so the per-line scrollbars of unwrapped code blocks were still shown. Add scrollbar-width: none to hide them.
1 parent 8cc7e84 commit ccbce24

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/css/code-block.scss‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@
165165
overflow-wrap: normal !important;
166166
overflow-x: auto;
167167
overscroll-behavior-x: contain;
168+
169+
/* ::-webkit-scrollbar is ignored when scrollbar-color/width is set (Obsidian sets it on body) */
170+
scrollbar-width: none;
168171
white-space: pre !important;
169172
word-wrap: normal;
170173

‎styles.css‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,8 @@ pre.codeblock-customizer-pre.codeblock-customizer-codeblock-semi-collapsed .code
14811481
overflow-wrap: normal !important;
14821482
overflow-x: auto;
14831483
overscroll-behavior-x: contain;
1484+
/* ::-webkit-scrollbar is ignored when scrollbar-color/width is set (Obsidian sets it on body) */
1485+
scrollbar-width: none;
14841486
white-space: pre !important;
14851487
word-wrap: normal;
14861488
}

0 commit comments

Comments
 (0)