Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: handle shift tab tab-index focus (#6554)

Vipin Chaudhary14083ea7da2c
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 4730cce057..2a17838fd8 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 051c863e8b..f06b1956df 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<Props> = observer((props) => {
)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
{button}
</button>
@@ -107,6 +108,7 @@ export const CycleDropdown: React.FC<Props> = observer((props) => {
)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
<DropdownButton
className={buttonClassName}
@@ -134,7 +136,6 @@ export const CycleDropdown: React.FC<Props> = observer((props) => {
<ComboDropDown
as="div"
ref={dropdownRef}
- tabIndex={tabIndex}
className={cn("h-full", className)}
value={value}
onChange={dropdownOnChange}
diff --git a/web/core/components/dropdowns/member/index.tsx b/web/core/components/dropdowns/member/index.tsx
index 0fa64ae1fe..d86d315346 100644
--- a/web/core/components/dropdowns/member/index.tsx
+++ b/web/core/components/dropdowns/member/index.tsx
@@ -113,6 +113,7 @@ export const MemberDropdown: React.FC<Props> = observer((props) => {
className={cn("clickable block h-full w-full outline-none", buttonContainerClassName)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
{button}
</button>
@@ -130,6 +131,7 @@ export const MemberDropdown: React.FC<Props> = observer((props) => {
)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
<DropdownButton
className={cn("text-xs", buttonClassName)}
@@ -161,7 +163,6 @@ export const MemberDropdown: React.FC<Props> = observer((props) => {
<ComboDropDown
as="div"
ref={dropdownRef}
- tabIndex={tabIndex}
className={cn("h-full", className)}
onChange={dropdownOnChange}
onKeyDown={handleKeyDown}
diff --git a/web/core/components/dropdowns/module/index.tsx b/web/core/components/dropdowns/module/index.tsx
index 63d47b72dd..f9233e0b27 100644
--- a/web/core/components/dropdowns/module/index.tsx
+++ b/web/core/components/dropdowns/module/index.tsx
@@ -239,6 +239,7 @@ export const ModuleDropdown: React.FC<Props> = observer((props) => {
)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
{button}
</button>
@@ -256,6 +257,7 @@ export const ModuleDropdown: React.FC<Props> = observer((props) => {
)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
<DropdownButton
className={buttonClassName}
@@ -296,7 +298,6 @@ export const ModuleDropdown: React.FC<Props> = observer((props) => {
<ComboDropDown
as="div"
ref={dropdownRef}
- tabIndex={tabIndex}
className={cn("h-full", className)}
onKeyDown={handleKeyDown}
button={comboButton}
diff --git a/web/core/components/dropdowns/priority.tsx b/web/core/components/dropdowns/priority.tsx
index 4009405571..dfc0ff0712 100644
--- a/web/core/components/dropdowns/priority.tsx
+++ b/web/core/components/dropdowns/priority.tsx
@@ -394,6 +394,7 @@ export const PriorityDropdown: React.FC<Props> = (props) => {
className={cn("clickable block h-full w-full outline-none", buttonContainerClassName)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
{button}
</button>
@@ -411,6 +412,7 @@ export const PriorityDropdown: React.FC<Props> = (props) => {
)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
<ButtonToRender
priority={value ?? undefined}
@@ -435,7 +437,6 @@ export const PriorityDropdown: React.FC<Props> = (props) => {
<ComboDropDown
as="div"
ref={dropdownRef}
- tabIndex={tabIndex}
className={cn(
"h-full",
{
diff --git a/web/core/components/dropdowns/state.tsx b/web/core/components/dropdowns/state.tsx
index 566d89fc36..04937590e1 100644
--- a/web/core/components/dropdowns/state.tsx
+++ b/web/core/components/dropdowns/state.tsx
@@ -141,11 +141,13 @@ export const StateDropdown: React.FC<Props> = observer((props) => {
className={cn("clickable block h-full w-full outline-none", buttonContainerClassName)}
onClick={handleOnClick}
disabled={disabled}
+ tabIndex={tabIndex}
>
{button}
</button>
) : (
<button
+ tabIndex={tabIndex}
ref={setReferenceElement}
type="button"
className={cn(
@@ -197,7 +199,6 @@ export const StateDropdown: React.FC<Props> = observer((props) => {
<ComboDropDown
as="div"
ref={dropdownRef}
- tabIndex={tabIndex}
className={cn("h-full", className)}
value={stateValue}
onChange={dropdownOnChange}
diff --git a/web/core/components/issues/issue-modal/components/title-input.tsx b/web/core/components/issues/issue-modal/components/title-input.tsx
index d737329fb5..bce1940229 100644
--- a/web/core/components/issues/issue-modal/components/title-input.tsx
+++ b/web/core/components/issues/issue-modal/components/title-input.tsx
@@ -37,7 +37,7 @@ export const IssueTitleInput: React.FC<TIssueTitleInputProps> = observer((props)
return undefined;
};
return (
- <>
+ <div tabIndex={getIndex("name")}>
<Controller
control={control}
name="name"
@@ -63,12 +63,11 @@ export const IssueTitleInput: React.FC<TIssueTitleInputProps> = observer((props)
hasError={Boolean(errors.name)}
placeholder={t("title")}
className="w-full text-base"
- tabIndex={getIndex("name")}
autoFocus
/>
)}
/>
<span className="text-xs font-medium text-red-500">{errors?.name?.message}</span>
- </>
+ </div>
);
});
diff --git a/web/core/components/issues/issue-modal/form.tsx b/web/core/components/issues/issue-modal/form.tsx
index 21fd4632c9..df660426c3 100644
--- a/web/core/components/issues/issue-modal/form.tsx
+++ b/web/core/components/issues/issue-modal/form.tsx
@@ -485,7 +485,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
setSelectedParentIssue={setSelectedParentIssue}
/>
</div>
- <div className="flex items-center justify-end gap-4 py-3">
+ <div className="flex items-center justify-end gap-4 py-3" tabIndex={getIndex("create_more")}>
{!data?.id && (
<div
className="inline-flex items-center gap-1.5 cursor-pointer"
@@ -493,7 +493,6 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
onKeyDown={(e) => {
if (e.key === "Enter") onCreateMoreToggleChange(!isCreateMoreToggleEnabled);
}}
- tabIndex={getIndex("create_more")}
role="button"
>
<ToggleSwitch value={isCreateMoreToggleEnabled} onChange={() => {}} size="sm" />
@@ -501,34 +500,37 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
</div>
)}
<div className="flex items-center gap-2">
- <Button
- variant="neutral-primary"
- size="sm"
- onClick={() => {
- if (editorRef.current?.isEditorReadyToDiscard()) {
- onClose();
- } else {
- setToast({
- type: TOAST_TYPE.ERROR,
- title: "Error!",
- message: "Editor is still processing changes. Please wait before proceeding.",
- });
- }
- }}
- tabIndex={getIndex("discard_button")}
- >
- {t("discard")}
- </Button>
- <Button
- variant={moveToIssue ? "neutral-primary" : "primary"}
- type="submit"
- size="sm"
- ref={submitBtnRef}
- loading={isSubmitting}
- tabIndex={isDraft ? getIndex("submit_button") : getIndex("draft_button")}
- >
- {isSubmitting ? primaryButtonText.loading : primaryButtonText.default}
- </Button>
+ <div tabIndex={getIndex("discard_button")}>
+ <Button
+ variant="neutral-primary"
+ size="sm"
+ onClick={() => {
+ if (editorRef.current?.isEditorReadyToDiscard()) {
+ onClose();
+ } else {
+ setToast({
+ type: TOAST_TYPE.ERROR,
+ title: "Error!",
+ message: "Editor is still processing changes. Please wait before proceeding.",
+ });
+ }
+ }}
+ >
+ {t("discard")}
+ </Button>
+ </div>
+ <div tabIndex={isDraft ? getIndex("submit_button") : getIndex("draft_button")}>
+ <Button
+ variant={moveToIssue ? "neutral-primary" : "primary"}
+ type="submit"
+ size="sm"
+ ref={submitBtnRef}
+ loading={isSubmitting}
+ >
+ {isSubmitting ? primaryButtonText.loading : primaryButtonText.default}
+ </Button>
+ </div>
+
{moveToIssue && (
<Button
variant="primary"
diff --git a/web/core/components/issues/select/label.tsx b/web/core/components/issues/select/label.tsx
index 28407b3e71..2dc21e7f41 100644
--- a/web/core/components/issues/select/label.tsx
+++ b/web/core/components/issues/select/label.tsx
@@ -112,31 +112,29 @@ export const IssueLabelSelect: React.FC<Props> = observer((props) => {
disabled={disabled}
onKeyDown={handleKeyDown}
>
- <Combobox.Button as={Fragment}>
- <button
- type="button"
- ref={setReferenceElement}
- className={cn("h-full flex cursor-pointer items-center gap-2 text-xs text-custom-text-200", buttonClassName)}
- onClick={handleOnClick}
- >
- {label ? (
- label
- ) : value && value.length > 0 ? (
- <span className="flex items-center justify-center gap-2 text-xs h-full">
- <IssueLabelsList
- labels={value.map((v) => projectLabels?.find((l) => l.id === v)) ?? []}
- length={3}
- showLength
- />
- </span>
- ) : (
- <div className="h-full flex items-center justify-center gap-1 rounded border-[0.5px] border-custom-border-300 px-2 py-1 text-xs hover:bg-custom-background-80">
- <Tag className="h-3 w-3 flex-shrink-0" />
- <span>{t("labels")}</span>
- </div>
- )}
- </button>
- </Combobox.Button>
+ <button
+ type="button"
+ ref={setReferenceElement}
+ className={cn("h-full flex cursor-pointer items-center gap-2 text-xs text-custom-text-200", buttonClassName)}
+ onClick={handleOnClick}
+ >
+ {label ? (
+ label
+ ) : value && value.length > 0 ? (
+ <span className="flex items-center justify-center gap-2 text-xs h-full">
+ <IssueLabelsList
+ labels={value.map((v) => projectLabels?.find((l) => l.id === v)) ?? []}
+ length={3}
+ showLength
+ />
+ </span>
+ ) : (
+ <div className="h-full flex items-center justify-center gap-1 rounded border-[0.5px] border-custom-border-300 px-2 py-1 text-xs hover:bg-custom-background-80">
+ <Tag className="h-3 w-3 flex-shrink-0" />
+ <span>{t("labels")}</span>
+ </div>
+ )}
+ </button>
{isDropdownOpen && (
<Combobox.Options className="fixed z-10" static>