aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src/Keyboard/Keys/KeyValue.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/Keyboard/Keys/KeyValue.js')
-rw-r--r--app/src/Keyboard/Keys/KeyValue.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/app/src/Keyboard/Keys/KeyValue.js b/app/src/Keyboard/Keys/KeyValue.js
index 71f6960..7aea967 100644
--- a/app/src/Keyboard/Keys/KeyValue.js
+++ b/app/src/Keyboard/Keys/KeyValue.js
@@ -1,3 +1,5 @@
+import { useMemo } from 'react'
+
import Icon from '../../Common/Icon'
import styles from './styles.module.css'
@@ -11,16 +13,21 @@ export default function KeyValue(props) {
const text = source && <span>{source?.symbol || source?.code}</span>
const icon = source?.faIcon && <Icon name={source.faIcon} />
+ const handleClick = useMemo(() => function (event) {
+ event.stopPropagation()
+ onSelect({
+ target: event.target,
+ codeIndex: index,
+ code: value,
+ param
+ })
+ }, [param, value, index, onSelect])
+
return (
<span
className={styles.code}
title={title}
- onClick={event => onSelect({
- target: event.target,
- codeIndex: index,
- code: value,
- param
- })}
+ onClick={handleClick}
>
{icon || text || <NullKey />}
</span>