From ccbce2465c76b192fbf8a66f625c1114e3953b95 Mon Sep 17 00:00:00 2001 From: kawase Date: Sun, 22 Nov 2026 22:07:43 +0900 Subject: [PATCH] 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. --- src/css/code-block.scss | 3 +++ styles.css | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/css/code-block.scss b/src/css/code-block.scss index 1288fe3..143a34a 100644 --- a/src/css/code-block.scss +++ b/src/css/code-block.scss @@ -165,6 +165,9 @@ overflow-wrap: normal !important; overflow-x: auto; overscroll-behavior-x: contain; + + /* ::-webkit-scrollbar is ignored when scrollbar-color/width is set (Obsidian sets it on body) */ + scrollbar-width: none; white-space: pre !important; word-wrap: normal; diff --git a/styles.css b/styles.css index db229b6..7ea8699 100644 --- a/styles.css +++ b/styles.css @@ -1481,6 +1481,8 @@ pre.codeblock-customizer-pre.codeblock-customizer-codeblock-semi-collapsed .code overflow-wrap: normal !important; overflow-x: auto; overscroll-behavior-x: contain; + /* ::-webkit-scrollbar is ignored when scrollbar-color/width is set (Obsidian sets it on body) */ + scrollbar-width: none; white-space: pre !important; word-wrap: normal; }