mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 09:48:28 +02:00
Autofocus buttons
This commit is contained in:
@@ -8,9 +8,9 @@ module.exports = {
|
|||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
"eslint-config-prettier"
|
"eslint-config-prettier"
|
||||||
],
|
],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: "@typescript-eslint/parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: ['./tsconfig.json'],
|
project: ["./tsconfig.json"]
|
||||||
},
|
},
|
||||||
ignorePatterns: ["src-tauri/**/*"],
|
ignorePatterns: ["src-tauri/**/*"],
|
||||||
settings: {
|
settings: {
|
||||||
@@ -25,13 +25,13 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"jsx-a11y/no-autofocus": "warn",
|
"jsx-a11y/no-autofocus": "off",
|
||||||
"react/react-in-jsx-scope": "off",
|
"react/react-in-jsx-scope": "off",
|
||||||
"import/no-unresolved": "off",
|
"import/no-unresolved": "off",
|
||||||
"@typescript-eslint/consistent-type-imports": ["error", {
|
"@typescript-eslint/consistent-type-imports": ["error", {
|
||||||
prefer: "type-imports",
|
prefer: "type-imports",
|
||||||
disallowTypeAnnotations: true,
|
disallowTypeAnnotations: true,
|
||||||
fixStyle: "separate-type-imports"
|
fixStyle: "separate-type-imports"
|
||||||
}],
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,6 +49,17 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceDropdown({ classN
|
|||||||
return (
|
return (
|
||||||
<HStack space={2} justifyContent="end" className="mt-6">
|
<HStack space={2} justifyContent="end" className="mt-6">
|
||||||
<Button
|
<Button
|
||||||
|
className="focus"
|
||||||
|
color="gray"
|
||||||
|
onClick={() => {
|
||||||
|
hide();
|
||||||
|
routes.navigate('workspace', { workspaceId: w.id });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
This Window
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
autoFocus
|
||||||
className="focus"
|
className="focus"
|
||||||
color="gray"
|
color="gray"
|
||||||
rightSlot={<Icon icon="openNewWindow" />}
|
rightSlot={<Icon icon="openNewWindow" />}
|
||||||
@@ -61,16 +72,6 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceDropdown({ classN
|
|||||||
>
|
>
|
||||||
New Window
|
New Window
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
|
||||||
className="focus"
|
|
||||||
color="gray"
|
|
||||||
onClick={() => {
|
|
||||||
hide();
|
|
||||||
routes.navigate('workspace', { workspaceId: w.id });
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
This Window
|
|
||||||
</Button>
|
|
||||||
</HStack>
|
</HStack>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,12 +19,6 @@ const confirmButtonTexts: Record<NonNullable<ConfirmProps['variant']>, string> =
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function Confirm({ onHide, onResult, variant = 'confirm' }: ConfirmProps) {
|
export function Confirm({ onHide, onResult, variant = 'confirm' }: ConfirmProps) {
|
||||||
const focusRef = (el: HTMLButtonElement | null) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
el?.focus();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleHide = () => {
|
const handleHide = () => {
|
||||||
onResult(false);
|
onResult(false);
|
||||||
onHide();
|
onHide();
|
||||||
@@ -40,7 +34,7 @@ export function Confirm({ onHide, onResult, variant = 'confirm' }: ConfirmProps)
|
|||||||
<Button className="focus" color="gray" onClick={handleHide}>
|
<Button className="focus" color="gray" onClick={handleHide}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="focus" ref={focusRef} color={colors[variant]} onClick={handleSuccess}>
|
<Button autoFocus className="focus" color={colors[variant]} onClick={handleSuccess}>
|
||||||
{confirmButtonTexts[variant]}
|
{confirmButtonTexts[variant]}
|
||||||
</Button>
|
</Button>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|||||||
Reference in New Issue
Block a user