Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(tags): block tag menu click outside from tiggering list select (#5684)
Seamus0b0cb033eccd
diff --git a/apps/web/src/features/property/tags/EntityRowTags.tsx b/apps/web/src/features/property/tags/EntityRowTags.tsxindex ee3f8d11cf..922666e88f 100644--- a/apps/web/src/features/property/tags/EntityRowTags.tsx+++ b/apps/web/src/features/property/tags/EntityRowTags.tsx@@ -182,6 +182,7 @@ function TagChip(props: {createDocTags: CreateDocTags;onFilterByTag?: (id: string) => void;onEdit: (tag: ResolvedTag) => void;+ withClickBlock: boolean;}) {const [pickerOpen, setPickerOpen] = createSignal(false);return (@@ -202,6 +203,7 @@ function TagChip(props: {triggerClass={chipClass}triggerLabel={`Change or select tag ${props.tag.label}`}onOpenChange={setPickerOpen}+ withClickBlock={props.withClickBlock}><TagDot color={props.tag.color} class="size-2" /><span class="min-w-0 truncate">{props.tag.label}</span>@@ -216,6 +218,7 @@ function TagOverflow(props: {createDocTags: CreateDocTags;onFilterByTag?: (id: string) => void;onEdit: (tag: ResolvedTag) => void;+ withClickBlock: boolean;}) {const [pickerOpen, setPickerOpen] = createSignal(false);const dots = () => props.tags.slice(0, MAX_OVERFLOW_DOTS);@@ -246,6 +249,7 @@ function TagOverflow(props: {triggerClass={cn(chipClass, 'gap-1.5')}triggerLabel="Edit tags"onOpenChange={setPickerOpen}+ withClickBlock={props.withClickBlock}><span class="flex items-center"><For each={dots()}>@@ -300,6 +304,7 @@ export function EntityRowTags(props: {createDocTags={createDocTags}onFilterByTag={props.onFilterByTag}onEdit={setEditingTag}+ withClickBlock/>)}</For>@@ -309,6 +314,7 @@ export function EntityRowTags(props: {createDocTags={createDocTags}onFilterByTag={props.onFilterByTag}onEdit={setEditingTag}+ withClickBlock/></Show><Show when={editingTag()}>diff --git a/apps/web/src/features/property/tags/TagPicker.tsx b/apps/web/src/features/property/tags/TagPicker.tsxindex 95fc948736..f30649f2af 100644--- a/apps/web/src/features/property/tags/TagPicker.tsx+++ b/apps/web/src/features/property/tags/TagPicker.tsx@@ -74,6 +74,11 @@ type TagPickerProps = {triggerLabel: string;children: JSX.Element;onOpenChange?: (open: boolean) => void;+ /**+ * Prevent the click that dismisses the picker from activating the element+ * behind it. This matches inline property editors rendered in soup rows.+ */+ withClickBlock?: boolean;} & (| { docTags: DocTags; createDocTags?: never }| { docTags?: never; createDocTags: () => DocTags }@@ -159,6 +164,7 @@ export function TagPicker(props: TagPickerProps) {setCreateSuccessHandler(undefined);restoreFocusToTrigger();}}+ withClickBlock={props.withClickBlock ?? false}/></Show></Popover>@@ -181,6 +187,7 @@ function TagPickerBodyOwner(props: {registerSave: (handler: (() => Promise<void>) | undefined) => void;createSuccessHandler: () => CreateTagSuccessHandler | undefined;onEditorClose: () => void;+ withClickBlock: boolean;}) {// The factory is invoked under this conditionally-mounted component owner,// so row-level query/mutation hooks do not exist until the picker opens.@@ -198,6 +205,7 @@ function TagPickerBodyOwner(props: {onOpenEditEditor={props.onOpenEditEditor}registerSave={props.registerSave}suppressInitialOutsideEvents={false}+ withClickBlock={props.withClickBlock}/></Show><Show when={props.editorMode()}>@@ -303,6 +311,7 @@ function TagPickerBody(props: {) => void;registerSave: (handler: (() => Promise<void>) | undefined) => void;suppressInitialOutsideEvents: boolean;+ withClickBlock?: boolean;}) {const [search, setSearch] = createSignal('');const [saved, setSaved] = createSignal(false);@@ -324,6 +333,30 @@ function TagPickerBody(props: {const shouldIgnoreOutsideEvent = () =>props.suppressInitialOutsideEvents && initialOutsideEventGuard();+ const blockDismissalClick = () => {+ if (!props.withClickBlock) return;++ // Kobalte closes popovers on an outside interaction but leaves the+ // following click to bubble through to the row beneath it.+ const swallow = (clickEvent: PointerEvent) => {+ clickEvent.stopPropagation();+ clickEvent.preventDefault();+ };+ window.addEventListener('click', swallow, {+ capture: true,+ once: true,+ });+ window.addEventListener(+ 'pointerdown',+ () => {+ window.removeEventListener('click', swallow, {+ capture: true,+ });+ },+ { capture: true, once: true }+ );+ };+const initialAppliedTags = createMemo(() => props.docTags.appliedTags());const initialAppliedIds = createMemo(() => new Set(initialAppliedTags().map((tag) => tag.optionId))@@ -662,7 +695,11 @@ function TagPickerBody(props: {if (shouldIgnoreOutsideEvent()) event.preventDefault();}}onInteractOutside={(event) => {- if (shouldIgnoreOutsideEvent()) event.preventDefault();+ if (shouldIgnoreOutsideEvent()) {+ event.preventDefault();+ return;+ }+ blockDismissalClick();}}><Show