Skip to content

Commit

Permalink
fix(input-number): the focus event is still triggered when disabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
betavs authored Oct 19, 2024
1 parent 9611e6b commit f475cc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/input-number/hooks/useInputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default function useInputNumber(props: TdInputNumberProps) {
ArrowUp: handleAdd,
ArrowDown: handleReduce,
};
const code = e.code || e.key;
const code = (e.code || e.key) as keyof typeof keyEvent;
if (keyEvent[code] !== undefined) {
keyEvent[code](e);
}
Expand Down Expand Up @@ -248,6 +248,7 @@ export default function useInputNumber(props: TdInputNumberProps) {
};

const focus = () => {
if (tDisabled.value || isReadonly.value) return;
(inputRef.value as any).focus();
};

Expand Down

0 comments on commit f475cc3

Please sign in to comment.