Skip to content

Commit 9391139

Browse files
Fix bug that added aria-hidden to everything
1 parent 19a3288 commit 9391139

File tree

1 file changed

+14
-43
lines changed

1 file changed

+14
-43
lines changed

src/components/EditCodeDialog.tsx

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,16 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6-
import {
7-
Box,
8-
Flex,
9-
Modal,
10-
ModalBody,
11-
ModalContent,
12-
ModalOverlay,
13-
} from "@chakra-ui/react";
6+
import { Flex } from "@chakra-ui/react";
147
import { MakeCodeFrameDriver } from "@microbit/makecode-embed/react";
15-
import { forwardRef, memo, useEffect, useRef } from "react";
8+
import { forwardRef, memo, useEffect } from "react";
169
import { useStore } from "../store";
1710
import Editor from "./Editor";
1811

1912
interface EditCodeDialogProps {}
2013

2114
const EditCodeDialog = forwardRef<MakeCodeFrameDriver, EditCodeDialogProps>(
2215
function EditCodeDialog(_, ref) {
23-
const containerRef = useRef<HTMLDivElement>(null);
2416
const isOpen = useStore((s) => s.isEditorOpen);
2517
const tourStart = useStore((s) => s.tourStart);
2618
useEffect(() => {
@@ -29,39 +21,18 @@ const EditCodeDialog = forwardRef<MakeCodeFrameDriver, EditCodeDialogProps>(
2921
}
3022
}, [isOpen, tourStart]);
3123
return (
32-
<>
33-
<Box
34-
ref={containerRef}
35-
transform={isOpen ? undefined : "translate(-150vw, -150vh)"}
36-
visibility={isOpen ? "visible" : "hidden"}
37-
/>
38-
<Modal
39-
size="full"
40-
isOpen={true}
41-
onClose={() => {}}
42-
closeOnEsc={false}
43-
blockScrollOnMount={false}
44-
portalProps={{
45-
containerRef: containerRef,
46-
}}
47-
>
48-
<ModalOverlay>
49-
<ModalContent>
50-
<ModalBody
51-
p={0}
52-
display="flex"
53-
alignItems="stretch"
54-
flexDir="column"
55-
justifyContent="stretch"
56-
>
57-
<Flex flexGrow="1" flexDir="column" w="100%" bgColor="white">
58-
<Editor ref={ref} style={{ flexGrow: 1 }} />
59-
</Flex>
60-
</ModalBody>
61-
</ModalContent>
62-
</ModalOverlay>
63-
</Modal>
64-
</>
24+
<Flex
25+
flexGrow="1"
26+
flexDir="column"
27+
w="100%"
28+
h="100%"
29+
bgColor="white"
30+
transform={isOpen ? undefined : "translate(-150vw, -150vh)"}
31+
visibility={isOpen ? "visible" : "hidden"}
32+
position={isOpen ? "unset" : "absolute"}
33+
>
34+
<Editor ref={ref} style={{ flexGrow: 1 }} />
35+
</Flex>
6536
);
6637
}
6738
);

0 commit comments

Comments
 (0)