Add keyboard shortcut for info sheet and fix input field shortcut blocki

This commit is contained in:
Riccardo Giorato
2025-12-26 21:36:55 +01:00
parent 0710982f9d
commit d8f0046c14
2 changed files with 28 additions and 8 deletions
@@ -113,10 +113,22 @@ export function StoryEditorClient() {
// Keyboard navigation
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
// Don't trigger shortcuts if user is typing in an input field
const target = e.target as HTMLElement;
if (
target.tagName === "INPUT" ||
target.tagName === "TEXTAREA" ||
target.isContentEditable
) {
return;
}
if (e.key === "ArrowRight") {
setCurrentPage((prev) => (prev < pages.length - 1 ? prev + 1 : prev));
} else if (e.key === "ArrowLeft") {
setCurrentPage((prev) => (prev > 0 ? prev - 1 : prev));
} else if (e.key === "i" || e.key === "I") {
setShowInfoSheet(true);
}
};