Calculator keystroke fixes
This commit is contained in:
@@ -114,6 +114,14 @@ const CalculatorPopover: Component = () => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (!isOpen()) return;
|
||||
|
||||
// Don't intercept if an input is focused
|
||||
const activeElement = document.activeElement;
|
||||
const isInputFocused = activeElement instanceof HTMLInputElement ||
|
||||
activeElement instanceof HTMLTextAreaElement ||
|
||||
activeElement?.hasAttribute('contenteditable');
|
||||
|
||||
if (isInputFocused) return;
|
||||
|
||||
if (e.key >= '0' && e.key <= '9') {
|
||||
handleNumberClick(e.key);
|
||||
} else if (e.key === '.') {
|
||||
|
||||
Reference in New Issue
Block a user