File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -167,12 +167,22 @@ const ErrorPane = () => {
167
167
168
168
return (
169
169
< >
170
+ { /*
171
+ * biome-ignore lint/a11y/useKeyWithClickEvents: key events don't seem to
172
+ * work for divs, and I'm otherwise not sure how to make this element
173
+ * more accesible. But I think it's fine since the functionality is able to
174
+ * be used with the button.
175
+ */ }
170
176
< div
171
177
aria-hidden = { true }
178
+ role = "alertdialog"
172
179
className = { cn (
173
- "pointer-events-none absolute top-0 left-0 h-full w-full transition-all" ,
180
+ "absolute top-0 left-0 h-full w-full transition-all" ,
174
181
$errors . show && "bg-black/20 dark:bg-black/50" ,
175
182
) }
183
+ onClick = { ( ) => {
184
+ $toggleShowError ( false ) ;
185
+ } }
176
186
>
177
187
{ /* OVERLAY */ }
178
188
</ div >
@@ -185,7 +195,8 @@ const ErrorPane = () => {
185
195
>
186
196
< button
187
197
className = "flex h-4 min-h-4 w-full items-center justify-center rounded-t-xl bg-border-destructive"
188
- onClick = { $toggleShowError }
198
+ onClick = { ( ) => $toggleShowError ( ) }
199
+ aria-label = { $errors . show ? "Hide error dialog" : "Show error dialog" }
189
200
>
190
201
< div className = "h-0.5 w-2/3 max-w-32 rounded-full bg-white/40" > </ div >
191
202
</ button >
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ type State = {
26
26
errors : ErrorsState ;
27
27
setCode : ( code : string ) => void ;
28
28
setError : ( diagnostics : Diagnostic [ ] ) => void ;
29
- toggleShowError : ( ) => void ;
29
+ toggleShowError : ( open ?: boolean ) => void ;
30
30
setWasmState : ( wasmState : WasmState ) => void ;
31
31
} ;
32
32
@@ -42,13 +42,13 @@ export const useStore = create<State>()((set) => ({
42
42
errors : { ...errors , diagnostics : data } ,
43
43
} ;
44
44
} ) ,
45
- toggleShowError : ( ) =>
45
+ toggleShowError : ( open ) =>
46
46
set ( ( state ) => {
47
47
const errors = state . errors ?? defaultErrorsState ;
48
48
return {
49
49
errors : {
50
50
...errors ,
51
- show : ! errors . show ,
51
+ show : open !== undefined ? open : ! errors . show ,
52
52
} ,
53
53
} ;
54
54
} ) ,
You can’t perform that action at this time.
0 commit comments