Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions oxlint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4890,22 +4890,6 @@
"count": 5
}
},
"web/app/components/workflow/nodes/tool/components/__tests__/copy-id.spec.tsx": {
"jsx_a11y/click-events-have-key-events": {
"count": 1
},
"jsx_a11y/no-static-element-interactions": {
"count": 1
}
},
"web/app/components/workflow/nodes/tool/components/copy-id.tsx": {
"jsx_a11y/click-events-have-key-events": {
"count": 1
},
"jsx_a11y/no-static-element-interactions": {
"count": 1
}
},
"web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx": {
"typescript/no-explicit-any": {
"count": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ describe('tool/copy-id', () => {
expect(trigger).toHaveAccessibleName('appOverview.overview.appInfo.embedded.copy')
})

it('should stop click propagation from the outer wrapper', () => {
it('should stop click propagation from the copy button', () => {
const handleParentClick = vi.fn()
const { container } = render(
<div onClick={handleParentClick}>
<CopyId content="tool-123" />
</div>,
)
render(<CopyId content="tool-123" />)
document.body.addEventListener('click', handleParentClick)

fireEvent.click(container.querySelector('.inline-flex') as HTMLElement)
act(() => {
fireEvent.click(
screen.getByRole('button', {
name: 'appOverview.overview.appInfo.embedded.copy',
}),
)
vi.advanceTimersByTime(100)
})
document.body.removeEventListener('click', handleParentClick)

expect(handleParentClick).not.toHaveBeenCalled()
})
Expand Down
11 changes: 5 additions & 6 deletions web/app/components/workflow/nodes/tool/components/copy-id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ const CopyFeedbackNew = ({ content }: Props) => {
: t(($) => $[`${prefixEmbedded}.copy`], { ns: 'appOverview' })) || ''

return (
<div
className="inline-flex w-full pb-0.5"
onClick={(e) => e.stopPropagation()}
onMouseLeave={onMouseLeave}
>
<div className="inline-flex w-full pb-0.5" onMouseLeave={onMouseLeave}>
<Tooltip>
<TooltipTrigger
render={
<button
type="button"
aria-label={tooltip}
className="group/copy flex w-full items-center gap-0.5 text-left"
onClick={onClickCopy}
onClick={(event) => {
event.stopPropagation()
onClickCopy()
}}
>
<span className="w-0 grow cursor-pointer truncate system-2xs-regular text-text-quaternary group-hover:text-text-tertiary">
{content}
Expand Down