Skip to content

Commit

Permalink
wip: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jul 3, 2024
1 parent 07c47de commit 5ed5e2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion webui/src/Buttons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export const ButtonsPage = observer(function ButtonsPage({ hotPress }: ButtonsPa
(e: React.KeyboardEvent) => {
const isControlOrCommandCombo = (e.ctrlKey || e.metaKey) && !e.altKey

// e.target is the actual element where the event happened, e.currentTarget is the element where the event listener is attached
const targetElement = e.target as HTMLElement

if (isControlOrCommandCombo && e.key === '=') {
e.preventDefault()
gridZoomController.zoomIn(true)
Expand All @@ -78,7 +81,7 @@ export const ButtonsPage = observer(function ButtonsPage({ hotPress }: ButtonsPa
} else if (isControlOrCommandCombo && e.key === '0') {
e.preventDefault()
gridZoomController.zoomReset()
} else if (e.currentTarget.tagName !== 'INPUT' && e.currentTarget.tagName !== 'TEXTAREA') {
} else if (targetElement.tagName !== 'INPUT' && targetElement.tagName !== 'TEXTAREA') {
switch (e.key) {
case 'ArrowDown':
setSelectedButton((selectedButton) => {
Expand Down
11 changes: 7 additions & 4 deletions webui/src/Components/TextInputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ const VariablesSelectContext = React.createContext({
blurClearValue: () => {},
title: undefined as string | undefined,
placeholder: undefined as string | undefined,
inputRef: { current: null } as React.MutableRefObject<HTMLInputElement | null>,
inputRef: { current: null } as React.MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null>,
})

const CustomOption = React.memo((props: OptionProps<DropdownChoiceInt>) => {
Expand Down Expand Up @@ -459,7 +459,9 @@ const CustomValueContainerTextInput = React.memo((props: ValueContainerProps<Dro
return (
<SelectComponents.ValueContainer {...props} isDisabled>
<CFormInput
ref={context.inputRef}
ref={(elm) => {
context.inputRef.current = elm
}}
type="text"
style={context.extraStyle}
title={context.title}
Expand Down Expand Up @@ -487,8 +489,9 @@ const CustomValueContainerTextarea = React.memo((props: ValueContainerProps<Drop
return (
<SelectComponents.ValueContainer {...props} isDisabled>
<CFormTextarea
innerRef={context.inputRef}
type="text"
ref={(elm) => {
context.inputRef.current = elm
}}
style={context.extraStyle}
title={context.title}
value={context.value}
Expand Down

0 comments on commit 5ed5e2e

Please sign in to comment.