Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(tasks): keep Create Task and tag search visible above the phone keyboard (#8833)

gbirman811b4725411e
diff --git a/apps/web/src/features/block-md/component/ComposeTask.tsx b/apps/web/src/features/block-md/component/ComposeTask.tsx
index f078d1d876..7b13315ba8 100644
--- a/apps/web/src/features/block-md/component/ComposeTask.tsx
+++ b/apps/web/src/features/block-md/component/ComposeTask.tsx
@@ -20,7 +20,9 @@ import type { PortalScope } from '@core/component/ScopedPortal';
import { toast } from '@core/component/Toast/Toast';
import { useUserId } from '@core/context/user';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { fireAndForget } from '@core/util/fireAndForget';
+import { onElementConnect } from '@core/util/onElementConnect';
import { buildSimpleEntityUrl } from '@core/util/url';
import ArrowSquareOutIcon from '@icon/system/regular/arrow-square-out.svg';
import ArrowsOutIcon from '@icon/system/regular/arrows-out.svg';
@@ -38,7 +40,7 @@ import { useUpsertToHistoryMutation } from '@queries/history/history';
import { useUserTeamsQuery } from '@queries/team/teams';
import { debounce } from '@solid-primitives/scheduled';
import { useQueryClient } from '@tanstack/solid-query';
-import { Button, EntityComposer, Scroll, ToggleSwitch, Tooltip } from '@ui';
+import { Button, cn, EntityComposer, Scroll, ToggleSwitch, Tooltip } from '@ui';
import type { LexicalEditor } from 'lexical';
import {
createEffect,
@@ -720,6 +722,30 @@ export function ComposeTask(props: ComposeTaskProps) {
const portalScope = (): PortalScope =>
splitPanel.handle.isPopover() ? 'local' : 'block';
+ // In the phone sheet the keyboard leaves too little room for the whole
+ // composer, so the footer pins to the bottom of the sheet's scroll. It only
+ // takes a background while pinned over content; at rest it would show as a
+ // band against the glass sheet.
+ const pinsFooter = () => isTouchDevice() && splitPanel.handle.isPopover();
+ const [footerPinned, setFooterPinned] = createSignal(false);
+ const observeFooter = (footer: HTMLElement) => {
+ if (!pinsFooter()) return;
+ onElementConnect(footer, () => {
+ const observer = new IntersectionObserver(
+ ([entry]) => setFooterPinned(!!entry && entry.intersectionRatio < 1),
+ {
+ root: footer.closest('[data-drawer-scroll-body]'),
+ // At rest the footer ends 16px above the viewport's bottom edge;
+ // pinned, it reaches the edge.
+ rootMargin: '0px 0px -15px 0px',
+ threshold: 1,
+ }
+ );
+ observer.observe(footer);
+ onCleanup(() => observer.disconnect());
+ });
+ };
+
return (
<EntityComposer.Root tabIndex={-1} ref={setContainerRef}>
<EntityComposer.Header>
@@ -932,7 +958,17 @@ export function ComposeTask(props: ComposeTaskProps) {
{/* The team switch, Create More and Create Task need about 400px; a
phone is narrower, so the actions wrap to their own row. */}
- <EntityComposer.Footer class="flex-wrap items-center">
+ <EntityComposer.Footer
+ ref={observeFooter}
+ class={cn(
+ 'flex-wrap items-center',
+ // -bottom-4 offsets the scroll body's bottom padding, which sticky
+ // positioning insets from.
+ pinsFooter() &&
+ 'sticky -bottom-4 z-1 -mx-4 -mt-3 -mb-4 px-4 pt-3 pb-4',
+ footerPinned() && 'bg-menu'
+ )}
+ >
<Show when={team()}>
{(team) => (
<Tooltip label={sharingHint()} tabIndex={0}>
diff --git a/apps/web/src/features/property/tags/TagPicker.tsx b/apps/web/src/features/property/tags/TagPicker.tsx
index bb85653b2d..fbf855eafc 100644
--- a/apps/web/src/features/property/tags/TagPicker.tsx
+++ b/apps/web/src/features/property/tags/TagPicker.tsx
@@ -1,5 +1,6 @@
import { useSplitLayout } from '@components/app/split-layout/layout';
import { useSplitPanel } from '@components/app/split-layout/layoutUtils';
+import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';
import { fireAndForget } from '@core/util/fireAndForget';
import CircleDashedEmpty from '@icon/system/regular/circle-dashed.svg';
import FilterIcon from '@icon/system/regular/funnel-simple.svg';
@@ -67,6 +68,10 @@ function nextDisplayOrder(options: PropertyOptionResponse[]): number {
}
const MAX_LIST_HEIGHT = 192;
+// The keyboard covers the layout viewport's bottom without shrinking it, so
+// flipping cannot see it: a picker opened low on a phone hides behind it.
+const pickerPlacement = () =>
+ virtualKeyboardVisible() ? 'top-start' : 'bottom-start';
const tagActionButtonClass =
'size-5 shrink-0 p-0.5 text-ink-extra-muted opacity-0 group-hover:opacity-100 focus-visible:opacity-100';
@@ -146,7 +151,7 @@ export function TagPicker(props: TagPickerProps) {
<Popover
open={open()}
onOpenChange={handleOpenChange}
- placement="bottom-start"
+ placement={pickerPlacement()}
gutter={4}
>
<Popover.Trigger
@@ -278,7 +283,7 @@ export function TagPickerPopover(props: {
open={props.open}
onOpenChange={handleOpenChange}
getAnchorRect={props.getAnchorRect}
- placement="bottom-start"
+ placement={pickerPlacement()}
gutter={4}
>
<Show when={props.open}>
diff --git a/docs/agent-guide/tasks.md b/docs/agent-guide/tasks.md
index 2f0882cfb6..51df83eec5 100644
--- a/docs/agent-guide/tasks.md
+++ b/docs/agent-guide/tasks.md
@@ -578,8 +578,13 @@ scrollable, keyboard-aware content. Its glass pane has broad screen-scaled
corners, an 8px outer inset, and a blurred backdrop, matching the create and
filter sheets. Its footer wraps when a phone is too narrow for one row: the
`Share with <team name>` switch keeps the left corner and `Create More` and
-`Create Task` move to a right-aligned row below it. `Create Task` shows no
-keyboard shortcut on touch. Desktop uses the centered composer dialog.
+`Create Task` move to a right-aligned row below it. When the keyboard leaves
+too little room for the whole composer, the footer pins to the bottom of the
+sheet (with a solid background only while pinned over content), so
+`Create Task` stays visible above the keyboard. `Create Task` shows no
+keyboard shortcut on touch. While the keyboard is up, the tag picker opens
+above its trigger so its search results stay above the keyboard. Desktop uses
+the centered composer dialog.
1. Click the `Task` button (or `Create` → `Task T`, or keyboard `c` then `t`).
2. A dialog opens with the title contenteditable focused (placeholder `New task`), plus