diff --git a/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js b/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js index 50c3b7bd2..81d31b27b 100644 --- a/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js +++ b/assets/js/hooks/cell_editor/live_editor/codemirror/theme.js @@ -18,6 +18,7 @@ function buildEditorTheme(colors, { dark }) { "&": { color: colors.text, backgroundColor: colors.background, + borderRadius: "8px", fontSize: "14px", fontFamily: fonts.mono, }, @@ -28,6 +29,11 @@ function buildEditorTheme(colors, { dark }) { ".cm-scroller": { fontFamily: "inherit", + // We add padding directly to the scroll container, rather + // than the editor parent, so that there is additional space + // for the scrollbar when it appears. Without this padding, + // the scrollbar would overlap the editor content + padding: "0.75rem 0", }, ".cm-content": { @@ -38,17 +44,19 @@ function buildEditorTheme(colors, { dark }) { // Scroll "*": { + "&": { + scrollbarWidth: "thin", + scrollbarColor: `${colors.backgroundLightest} transparent`, + }, + + // Fallback for Safari, which does not implement scrollbar-* + // CSS properties yet "&::-webkit-scrollbar": { width: "8px", height: "8px", }, "&::-webkit-scrollbar-thumb": { - borderRadius: "4px", - background: "transparent", - }, - - "&:hover::-webkit-scrollbar-thumb": { background: colors.backgroundLightest, }, diff --git a/lib/livebook_web/live/session_live/cell_component.ex b/lib/livebook_web/live/session_live/cell_component.ex index 1c78d3515..0ecd733cb 100644 --- a/lib/livebook_web/live/session_live/cell_component.ex +++ b/lib/livebook_web/live/session_live/cell_component.ex @@ -622,9 +622,9 @@ defmodule LivebookWeb.SessionLive.CellComponent do data-p-intellisense={hook_prop(@intellisense)} data-p-read-only={hook_prop(@read_only)} > -