Browse Source

fix: text editor not visible in dark mode (#2920)

vanilla_orig
David Luzar 4 years ago
parent
commit
6c81a32d62
No account linked to committer's email address
4 changed files with 17 additions and 4 deletions
  1. 2
    0
      src/components/LayerUI.scss
  2. 1
    1
      src/components/MobileMenu.tsx
  3. 12
    0
      src/css/styles.scss
  4. 2
    3
      src/element/textWysiwyg.tsx

+ 2
- 0
src/components/LayerUI.scss View File

@@ -38,6 +38,8 @@
38 38
   }
39 39
 
40 40
   .layer-ui__wrapper {
41
+    z-index: var(--zIndex-layerUI);
42
+
41 43
     .encrypted-icon {
42 44
       position: relative;
43 45
       margin-inline-start: 15px;

+ 1
- 1
src/components/MobileMenu.tsx View File

@@ -48,7 +48,7 @@ export const MobileMenu = ({
48 48
 }: MobileMenuProps) => {
49 49
   const renderFixedSideContainer = () => {
50 50
     return (
51
-      <FixedSideContainer side="top">
51
+      <FixedSideContainer side="top" className="App-top-bar">
52 52
         <Section heading="shapes">
53 53
           {(heading) => (
54 54
             <Stack.Col gap={4} align="center">

+ 12
- 0
src/css/styles.scss View File

@@ -1,6 +1,12 @@
1 1
 @import "./variables.module";
2 2
 @import "./theme";
3 3
 
4
+:root {
5
+  --zIndex-canvas: 1;
6
+  --zIndex-wysiwyg: 2;
7
+  --zIndex-layerUI: 3;
8
+}
9
+
4 10
 .excalidraw {
5 11
   color: var(--text-color-primary);
6 12
   display: flex;
@@ -30,6 +36,8 @@
30 36
     image-rendering: pixelated; // chromium
31 37
     // NOTE: must be declared *after* the above
32 38
     image-rendering: -moz-crisp-edges; // FF
39
+
40
+    z-index: var(--zIndex-canvas);
33 41
   }
34 42
 
35 43
   &.Appearance_dark {
@@ -216,6 +224,10 @@
216 224
     }
217 225
   }
218 226
 
227
+  .App-top-bar {
228
+    z-index: var(--zIndex-layerUI);
229
+  }
230
+
219 231
   .App-bottom-bar {
220 232
     position: absolute;
221 233
     top: 0;

+ 2
- 3
src/element/textWysiwyg.tsx View File

@@ -89,9 +89,6 @@ export const textWysiwyg = ({
89 89
   editable.dataset.type = "wysiwyg";
90 90
   // prevent line wrapping on Safari
91 91
   editable.wrap = "off";
92
-  editable.className = `excalidraw ${
93
-    appState.appearance === "dark" ? "Appearance_dark" : ""
94
-  }`;
95 92
 
96 93
   Object.assign(editable.style, {
97 94
     position: "fixed",
@@ -107,6 +104,8 @@ export const textWysiwyg = ({
107 104
     overflow: "hidden",
108 105
     // prevent line wrapping (`whitespace: nowrap` doesn't work on FF)
109 106
     whiteSpace: "pre",
107
+    // must be specified because in dark mode canvas creates a stacking context
108
+    zIndex: "var(--zIndex-wysiwyg)",
110 109
   });
111 110
 
112 111
   updateWysiwygStyle();

Loading…
Cancel
Save