Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): task sheet focus and swipe back

Andrejd71736cf06ad
diff --git a/apps/web/src/components/common/task-layout.tsx b/apps/web/src/components/common/task-layout.tsx
index 22fc60351..27addc01b 100644
--- a/apps/web/src/components/common/task-layout.tsx
+++ b/apps/web/src/components/common/task-layout.tsx
@@ -115,7 +115,7 @@ export default function TaskLayout({
workspaceId={workspaceId}
/>
) : (
- <div className="h-full min-h-0 overflow-y-auto overscroll-contain">
+ <div className="h-full min-h-0 overflow-y-auto overscroll-y-contain">
{children}
</div>
)}
diff --git a/apps/web/src/components/task/task-details-sheet.tsx b/apps/web/src/components/task/task-details-sheet.tsx
index 9cf147248..eb979b474 100644
--- a/apps/web/src/components/task/task-details-sheet.tsx
+++ b/apps/web/src/components/task/task-details-sheet.tsx
@@ -52,6 +52,7 @@ export default function TaskDetailsSheet({
}, [taskId]);
const closeButtonRef = useRef<HTMLButtonElement>(null);
+ const openedFromKeyboardRef = useRef(false);
const handleOpenFullPage = useCallback(() => {
if (!shownTaskId) return;
@@ -71,14 +72,20 @@ export default function TaskDetailsSheet({
side="right"
data-task-view
data-shortcuts="allow"
- className="w-full max-w-full gap-0 p-0 sm:max-w-lg md:max-w-2xl lg:max-w-4xl [&>button]:hidden"
+ className="w-full max-w-full gap-0 p-0 outline-none sm:max-w-lg md:max-w-2xl lg:max-w-4xl [&>button]:hidden"
// Focusing the first control would pop the "open in full page"
// tooltip over the actions every time the sheet opens on touch.
- initialFocus={closeButtonRef}
+ initialFocus={() => {
+ openedFromKeyboardRef.current =
+ document.activeElement?.matches(":focus-visible") ?? false;
+ return closeButtonRef.current ?? true;
+ }}
finalFocus={() =>
- document.querySelector<HTMLElement>(
+ openedFromKeyboardRef.current &&
+ (document.querySelector<HTMLElement>(
`[data-task-id="${lastTaskIdRef.current}"]`,
- ) ?? true
+ ) ??
+ true)
}
>
{shownTaskId && (
diff --git a/apps/web/src/components/ui/scroll-area.tsx b/apps/web/src/components/ui/scroll-area.tsx
index 4a048b3b4..d8fd6ca66 100644
--- a/apps/web/src/components/ui/scroll-area.tsx
+++ b/apps/web/src/components/ui/scroll-area.tsx
@@ -21,7 +21,7 @@ function ScrollArea({
>
<ScrollAreaPrimitive.Viewport
className={cn(
- "h-full overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain",
+ "h-full overscroll-y-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain",
scrollFade &&
"mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
scrollbarGutter &&