⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
improvement(web): submit the new issue dialog with Enter (#189)
Croff806b5bb84d36
diff --git a/apps/web/src/features/issue/components/create/NewIssueModal.tsx b/apps/web/src/features/issue/components/create/NewIssueModal.tsxindex 435faf46..2d76f901 100644--- a/apps/web/src/features/issue/components/create/NewIssueModal.tsx+++ b/apps/web/src/features/issue/components/create/NewIssueModal.tsx@@ -259,6 +259,31 @@ export default function NewIssueModal({}}+ // Enter creates the issue when the caret is in the title, or when no element has+ // focus: Radix then keeps focus on the dialog element itself. The handler ignores+ // focus inside the body editors or a nested dialog.+ const titleRef = useRef<HTMLInputElement>(null);+ // No dependency array: the handler reads the title and the saving flag of the+ // current render, so React registers it again after every render.+ useEffect(() => {+ function onKeyDown(e: KeyboardEvent) {+ if (e.key !== 'Enter' || e.shiftKey || e.metaKey || e.ctrlKey || e.altKey || e.isComposing)+ return;+ const active = document.activeElement;+ const isTitleFocused = active === titleRef.current;+ const isDialogFocused =+ active instanceof HTMLElement &&+ active.getAttribute('role') === 'dialog' &&+ active.contains(titleRef.current);+ if (!isTitleFocused && !isDialogFocused) return;+ e.preventDefault();+ if (saving || !title.trim()) return;+ void submit();+ }+ document.addEventListener('keydown', onKeyDown);+ return () => document.removeEventListener('keydown', onKeyDown);+ });+return (<Modaltitle={t('title')}@@ -280,6 +305,7 @@ export default function NewIssueModal({positioned ancestor, so the overlay covers the whole modal. */}{draggedFiles !== null && <NewIssueDropOverlay count={draggedFiles} />}<input+ ref={titleRef}// `auto` once there is something to read, so a title keeps the script it// was typed in. While the field is empty there is nothing to read from,// and it would fall back to left-to-right and strand the placeholder.