react-component / react-component/trigger
Click-away (close on outside click) does not work in ShadowDom for action "click"
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 391
- Fork
- 245
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với logic inPopupOrChild trong package trigger và tái hiện hành vi bằng cách sử dụng CodeSandbox được liên kết bên trong một Shadow DOM. Theo dõi cách các sự kiện mousedown và click được retarget, sau đó xác minh rằng việc nhấp bên ngoài popover sẽ đóng nó, trong khi nhấp vào trigger hoặc nội dung popover thì không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100