Skip to content

Commit

Permalink
fix: treat numpad "Enter" as regular "Enter"
Browse files Browse the repository at this point in the history
Closes #4543.

This partially reverts 9e7830f
(#4140)
and
23a0791
(#4140).
  • Loading branch information
WofWca committed Jan 24, 2025
1 parent 4f7e52c commit b27010a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
### Changed

### Fixed
- numpad "Enter" not working as regular "Enter" #4546

<a id="1_52_0"></a>

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export function ContextMenu(props: {
keyboardFocus.current = 0
}
}
} else if (ev.code == 'Enter') {
} else if (ev.key == 'Enter') {
if (current) {
;(current as HTMLDivElement)?.click()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ export default class ComposerMessageInput extends React.Component<
const enterKeySends = this.props.enterKeySends

// ENTER + CTRL
if (e.code === 'Enter' && (e.ctrlKey || e.metaKey)) {
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
return 'SEND'
// ENTER
} else if (e.code === 'Enter' && !e.shiftKey) {
} else if (e.key === 'Enter' && !e.shiftKey) {
return enterKeySends ? 'SEND' : undefined
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function AddMemberInnerDialog({
const itemCount = contactIds.length + (needToRenderAddContact ? 1 : 0)

const addContactOnKeyDown = (ev: React.KeyboardEvent<HTMLInputElement>) => {
if (ev.code == 'Enter') {
if (ev.key == 'Enter') {
// TODO refactor: this is fragile.
;(
contactListRef.current?.querySelector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function AccountSetupScreen({
// and not an explicit keyboard handling
const onKeyDown = useCallback(
(ev: KeyboardEvent) => {
if (ev.code === 'Enter') {
if (ev.key === 'Enter') {
ev.stopPropagation()
ev.preventDefault()
if (hasOpenDialogs) {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/keybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function keyDownEvent2Action(
return KeybindAction.Composer_CancelReply
}
} else if (
ev.code === 'Enter' &&
ev.key === 'Enter' &&
(ev.target as any).id === 'chat-list-search'
) {
return KeybindAction.ChatList_SearchSelectFirstChat
Expand Down

0 comments on commit b27010a

Please sign in to comment.