FIX: Makes sure tabIndex works properly on formatPicker dialog

This commit is contained in:
Daniel
2024-12-26 14:33:38 +01:00
committed by Nicolás Hatcher Andrés
parent a4c3233253
commit 185a70224c

View File

@@ -36,7 +36,12 @@ const FormatPicker = (properties: FormatPickerProps) => {
> >
<StyledDialogTitle> <StyledDialogTitle>
{t("num_fmt.title")} {t("num_fmt.title")}
<Cross onClick={handleClose} title={t("num_fmt.close")}> <Cross
onClick={handleClose}
title={t("num_fmt.close")}
tabIndex={0}
onKeyDown={(event) => event.key === "Enter" && properties.onClose()}
>
<X /> <X />
</Cross> </Cross>
</StyledDialogTitle> </StyledDialogTitle>
@@ -49,6 +54,10 @@ const FormatPicker = (properties: FormatPickerProps) => {
onChange={(event) => setFormatCode(event.target.value)} onChange={(event) => setFormatCode(event.target.value)}
onKeyDown={(event) => { onKeyDown={(event) => {
event.stopPropagation(); event.stopPropagation();
if (event.key === "Enter") {
onSubmit(formatCode);
properties.onClose();
}
}} }}
spellCheck="false" spellCheck="false"
onClick={(event) => event.stopPropagation()} onClick={(event) => event.stopPropagation()}
@@ -56,7 +65,16 @@ const FormatPicker = (properties: FormatPickerProps) => {
/> />
</StyledDialogContent> </StyledDialogContent>
<DialogFooter> <DialogFooter>
<StyledButton onClick={() => onSubmit(formatCode)}> <StyledButton
onClick={() => onSubmit(formatCode)}
onKeyDown={(event) => {
if (event.key === "Enter") {
onSubmit(formatCode);
properties.onClose();
}
}}
tabIndex={0}
>
<Check <Check
style={{ width: "16px", height: "16px", marginRight: "8px" }} style={{ width: "16px", height: "16px", marginRight: "8px" }}
/> />