Skip to content

Commit 4bd8d7e

Browse files
committed
fix: improve accesibility while error pane is open
1 parent e20e26a commit 4bd8d7e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Preview.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { type FC, useEffect, useState } from "react";
1515
export const Preview: FC = () => {
1616
const $wasmState = useStore((state) => state.wasmState);
1717
const $code = useStore((state) => state.code);
18+
const $errors = useStore((state) => state.errors);
1819
const $setError = useStore((state) => state.setError);
1920

2021
const [debouncedCode, isDebouncing] = useDebouncedValue($code, 1000);
@@ -74,8 +75,16 @@ export const Preview: FC = () => {
7475
) : null}
7576

7677
<div
77-
aria-hidden={$wasmState !== "loaded"}
78-
className="flex h-full w-full flex-col items-start gap-6 p-8"
78+
aria-hidden={
79+
$wasmState !== "loaded" ||
80+
($errors.show && $errors.diagnostics.length > 0)
81+
}
82+
className={cn(
83+
"flex h-full w-full flex-col items-start gap-6 p-8",
84+
($wasmState !== "loaded" ||
85+
($errors.show && $errors.diagnostics.length > 0)) &&
86+
"pointer-events-none",
87+
)}
7988
>
8089
<div className="flex w-full items-center justify-between">
8190
<p className="font-semibold text-3xl text-content-primary">

0 commit comments

Comments
 (0)