Files
Remote-Terminal-for-MeshCore/frontend/src/utils/a11y.ts
T
2026-03-02 20:34:06 -08:00

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();
}
}