From 14083ea7da2c2830426b1552c867b4519f6b4186 Mon Sep 17 00:00:00 2001 From: Vipin Chaudhary Date: Sat, 8 Feb 2025 20:54:23 +0530 Subject: [PATCH] fix: handle shift tab tab-index focus (#6554) * handle shift tab tab-index focus * add comment * fix double tap * make label focus * fix title focus * focus discard and save * remove comment --- .../custom-list-keymap/list-keymap.ts | 4 ++ web/core/components/dropdowns/cycle/index.tsx | 3 +- .../components/dropdowns/member/index.tsx | 3 +- .../components/dropdowns/module/index.tsx | 3 +- web/core/components/dropdowns/priority.tsx | 3 +- web/core/components/dropdowns/state.tsx | 3 +- .../issue-modal/components/title-input.tsx | 5 +- .../components/issues/issue-modal/form.tsx | 62 ++++++++++--------- web/core/components/issues/select/label.tsx | 48 +++++++------- 9 files changed, 71 insertions(+), 63 deletions(-) diff --git a/packages/editor/src/core/extensions/custom-list-keymap/list-keymap.ts b/packages/editor/src/core/extensions/custom-list-keymap/list-keymap.ts index 4730cce05..2a17838fd 100644 --- a/packages/editor/src/core/extensions/custom-list-keymap/list-keymap.ts +++ b/packages/editor/src/core/extensions/custom-list-keymap/list-keymap.ts @@ -51,6 +51,10 @@ export const ListKeymap = ({ tabIndex }: { tabIndex?: number }) => } else if (this.editor.commands.liftListItem("taskItem")) { return true; } + // if tabIndex is set, we don't want to handle Tab key + if (tabIndex !== undefined && tabIndex !== null) { + return false; + } return true; }, Delete: ({ editor }) => { diff --git a/web/core/components/dropdowns/cycle/index.tsx b/web/core/components/dropdowns/cycle/index.tsx index 051c863e8..f06b1956d 100644 --- a/web/core/components/dropdowns/cycle/index.tsx +++ b/web/core/components/dropdowns/cycle/index.tsx @@ -90,6 +90,7 @@ export const CycleDropdown: React.FC = observer((props) => { )} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > {button} @@ -107,6 +108,7 @@ export const CycleDropdown: React.FC = observer((props) => { )} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > = observer((props) => { = observer((props) => { className={cn("clickable block h-full w-full outline-none", buttonContainerClassName)} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > {button} @@ -130,6 +131,7 @@ export const MemberDropdown: React.FC = observer((props) => { )} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > = observer((props) => { = observer((props) => { )} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > {button} @@ -256,6 +257,7 @@ export const ModuleDropdown: React.FC = observer((props) => { )} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > = observer((props) => { = (props) => { className={cn("clickable block h-full w-full outline-none", buttonContainerClassName)} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > {button} @@ -411,6 +412,7 @@ export const PriorityDropdown: React.FC = (props) => { )} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > = (props) => { = observer((props) => { className={cn("clickable block h-full w-full outline-none", buttonContainerClassName)} onClick={handleOnClick} disabled={disabled} + tabIndex={tabIndex} > {button} ) : ( - +
+ +
+
+ +
+ {moveToIssue && ( - + {isDropdownOpen && (