Files
windmill/frontend/src/lib/components/common/CloseButton.svelte
T
Ruben FiszelandClaude Opus 4.6 b11d6ed794 fix(frontend): revert CloseButton refactor that broke tag removal in MultiSelect (#7909)
The recent refactor of CloseButton (from on:close component events to
onClick prop) broke tag removal in MultiSelect/TagsToListenTo. The
refactor changed on:pointerdown (component event) to onPointerdown
(native DOM event), which stopped native pointerdown propagation and
broke the drag tracking in DraggableTags, causing the dropdown to open
on every close button click.

Reverts CloseButton and all callers back to using createEventDispatcher
and on:close.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 14:27:50 +00:00

37 lines
888 B
Svelte

<script lang="ts">
import { createEventDispatcher } from 'svelte'
import Button from './button/Button.svelte'
import { X } from 'lucide-svelte'
import { twMerge } from 'tailwind-merge'
interface Props {
noBg?: boolean
small?: boolean
Icon?: any | undefined
class?: string
id?: string | undefined
onClick?: () => void | undefined | any
}
let { noBg = false, small = false, Icon, class: className, id, onClick }: Props = $props()
const dispatch = createEventDispatcher()
</script>
<Button
on:click={() => (dispatch('close'), onClick?.())}
on:pointerdown={(e) => e.stopPropagation()}
{id}
startIcon={{ icon: Icon ?? X }}
iconOnly
unifiedSize="sm"
color="light"
wrapperClasses="shrink-0"
btnClasses={twMerge(
'hover:bg-surface-hover rounded-full p-0 !min-h-0',
noBg ? '' : 'bg-surface-secondary',
small ? 'w-6 h-6' : 'w-8 h-8',
className ?? ''
)}
/>