Skip to content

Commit

Permalink
chore(web): ignore shortcut toggle when entering email and password (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 authored Aug 27, 2024
1 parent 16d5996 commit aac6a4b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions web/src/lib/actions/shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const shouldIgnoreShortcut = (event: KeyboardEvent): boolean => {
return false;
}
const type = (event.target as HTMLInputElement).type;
return ['textarea', 'text', 'date', 'datetime-local'].includes(type);
return ['textarea', 'text', 'date', 'datetime-local', 'email', 'password'].includes(type);
};

export const matchesShortcut = (event: KeyboardEvent, shortcut: Shortcut) => {
Expand Down Expand Up @@ -53,7 +53,6 @@ export const shortcuts = <T extends HTMLElement>(
): ActionReturn<ShortcutOptions<T>[]> => {
function onKeydown(event: KeyboardEvent) {
const ignoreShortcut = shouldIgnoreShortcut(event);

for (const { shortcut, onShortcut, ignoreInputFields = true, preventDefault = true } of options) {
if (ignoreInputFields && ignoreShortcut) {
continue;
Expand Down

0 comments on commit aac6a4b

Please sign in to comment.