Skip to content

Commit

Permalink
Make focused styles more specific.
Browse files Browse the repository at this point in the history
So that they no longer leak into nested editors.

FIX: Make sure styles targeting the editor's focus status are specific enough
to not cause them to apply to editors nested inside another focused editor. This
will require themes to adjust their selection background styles to match the new
specificity.

See https://discuss.codemirror.net/t/remove-blinking-cursor-inside-the-widget-with-cm-instance/6284
  • Loading branch information
marijnh committed Apr 17, 2023
1 parent 637b424 commit 0c921ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ export const baseTheme = buildTheme("." + baseThemeID, {
"&dark .cm-selectionBackground": {
background: "#222"
},
"&light.cm-focused .cm-selectionBackground": {
"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
background: "#d7d4f0"
},
"&dark.cm-focused .cm-selectionBackground": {
"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
background: "#233"
},

".cm-cursorLayer": {
pointerEvents: "none"
},
"&.cm-focused .cm-cursorLayer": {
"&.cm-focused > .cm-scroller > .cm-cursorLayer": {
animation: "steps(1) cm-blink 1.2s infinite"
},

Expand All @@ -135,7 +135,7 @@ export const baseTheme = buildTheme("." + baseThemeID, {
position: "absolute"
},

"&.cm-focused .cm-cursor": {
"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor": {
display: "block"
},

Expand Down

0 comments on commit 0c921ee

Please sign in to comment.