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 = () => {
167167
168168 return (
169169 < >
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+ */ }
170176 < div
171177 aria-hidden = { true }
178+ role = "alertdialog"
172179 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" ,
174181 $errors . show && "bg-black/20 dark:bg-black/50" ,
175182 ) }
183+ onClick = { ( ) => {
184+ $toggleShowError ( false ) ;
185+ } }
176186 >
177187 { /* OVERLAY */ }
178188 </ div >
@@ -185,7 +195,8 @@ const ErrorPane = () => {
185195 >
186196 < button
187197 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" }
189200 >
190201 < div className = "h-0.5 w-2/3 max-w-32 rounded-full bg-white/40" > </ div >
191202 </ button >
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ type State = {
2626 errors : ErrorsState ;
2727 setCode : ( code : string ) => void ;
2828 setError : ( diagnostics : Diagnostic [ ] ) => void ;
29- toggleShowError : ( ) => void ;
29+ toggleShowError : ( open ?: boolean ) => void ;
3030 setWasmState : ( wasmState : WasmState ) => void ;
3131} ;
3232
@@ -42,13 +42,13 @@ export const useStore = create<State>()((set) => ({
4242 errors : { ...errors , diagnostics : data } ,
4343 } ;
4444 } ) ,
45- toggleShowError : ( ) =>
45+ toggleShowError : ( open ) =>
4646 set ( ( state ) => {
4747 const errors = state . errors ?? defaultErrorsState ;
4848 return {
4949 errors : {
5050 ...errors ,
51- show : ! errors . show ,
51+ show : open !== undefined ? open : ! errors . show ,
5252 } ,
5353 } ;
5454 } ) ,
You can’t perform that action at this time.
0 commit comments