mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-06-12 09:24:53 +02:00
10 lines
324 B
TypeScript
10 lines
324 B
TypeScript
import type { KeyboardEvent } from 'react';
|
|
|
|
/** Activate a clickable non-button element on Enter or Space, mirroring native button behavior. */
|
|
export function handleKeyboardActivate(e: KeyboardEvent) {
|
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
e.preventDefault();
|
|
(e.currentTarget as HTMLElement).click();
|
|
}
|
|
}
|