We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5bdfec1 commit 241585eCopy full SHA for 241585e
packages/renderless/src/popover/index.ts
@@ -183,8 +183,10 @@ export const handleDocumentClick =
183
const $el = vm.$refs.root
184
let target = event.target as HTMLElement
185
186
- // 解决组件在webcomponents中触发document的click事件,但是e.target始终是webcomponents自定义标签,从而引起的判断失效的bug
187
- if (target?.shadowRoot && popperElm) {
+ // 点击在webcomponents上时,document监听事件的e.target始终是webcomponents自身,所以要判断处理:
+ // 1. 包含关系:popover使用在乾坤等场景时, popover包含在自定义组件内时, 需要替换target为 真实的 webComponent的内部dom, 再进行判断
188
+ // 2. 平级关系:比如页面上有popover 和一个平级关系的自定义dom元素,此时不需要替换target
189
+ if (target?.shadowRoot && target.shadowRoot.contains($el) && popperElm) {
190
target = state.webCompEventTarget as HTMLElement
191
}
192
0 commit comments