Click-away (close on outside click) does not work in ShadowDom for action "click"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start with the inPopupOrChild logic in the trigger package and reproduce the behavior using the linked CodeSandbox inside a Shadow DOM. Trace how the mousedown and click events are retargeted, then verify that clicking outside the popover closes it while clicking the trigger or popover content does not.
Written by the indexing model from the issue text.
Description
When using the popover from Antd in a WebComponent with the "click" action the "click away" does not work, the popover is never closed. When clicking on the trigger button the popover is closed.
<Popover content={<div>demo</div>} title="Title" trigger="click">
<Button>Click me</Button>
</Popover>
Expected:
Clicking on anything other than the popover content or the trigger (button in this case) the popover should close.
Actuall:
The popover is not closed.
Findings:
When using a popover from Antd inside a ShadoDom and using the trigger "click" the inPopupOrChild incorrectly thinks the mousedown/click is inside the content. There is something wrong in the checking of inPopupOrChild. The event retargeting makes the event come from the webcomponent and somehow the trigger thinks this is inside the content.
Workaround:
Catch the onMouseDown event in the webcomponent ctor and stop the bubbling with stopPropagation stops the event from reaching the global listener a second time.
- Dominant language
- TypeScript
- Stars
- 391
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-component/trigger
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
react-component/trigger#593 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
react-component/trigger#623 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
react-component/trigger#618 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
react-component/trigger#555 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
react-component/trigger#550 · 1 comment ·
All issues in react-component/trigger
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·