Retrospring/app/javascript/retrospring/features/answerbox/comment/hotkey.ts

8 lines
323 B
TypeScript
Raw Normal View History

2023-03-05 08:29:38 -08:00
export function commentHotkeyHandler(event: Event): void {
const button = event.target as HTMLButtonElement;
const id = button.dataset.aId;
document.querySelector(`#ab-comments-section-${id}`).classList.remove('d-none');
document.querySelector<HTMLElement>(`[name="ab-comment-new"][data-a-id="${id}"]`).focus();
}