[Bug] page-agent only clicks the outermost layer of multi-layer avatar-like elements, causing the click to have no effect
- Dominant language
- TypeScript
- Stars
- 29.1k
- Forks
- 2.6k
- Avg merge
- 12h 40m
- Merged PRs (30d)
- 10
Description
### What happened? / 问题描述
Some avatar-like elements have multiple layers. page-agent only clicks the outermost layer, so the click has no effect. I have provided a reproducible HTML example below.
一些类似头像的元素,有多个层级,page-agent只会点击最外层,导致点击无效。我在下面提供了复现的html
### How to reproduce / 如何复现
`
repro: 点击头像无反应
body {
margin: 40px;
font:
14px/1.6 system-ui,
sans-serif;
}
/* cursor: pointer 只声明在最外层,会被子元素继承 */
.aside_avatar {
width: 40px;
height: 40px;
cursor: pointer;
}
.avatar_img_box {
width: 100%;
height: 100%;
}
.imageSvg {
width: 24px;
height: 24px;
display: block;
}
#menu {
display: none;
margin: 12px 0 0;
padding: 8px 0;
width: 160px;
list-style: none;
border: 1px solid #ddd;
border-radius: 6px;
}
#menu.show {
display: block;
}
#menu li {
padding: 6px 12px;
}
- 个人信息
- 退出
// the click handler lives on the inner box, not on .aside_avatar
document.getElementById('avatarImgBox').addEventListener('click', () => {
document.getElementById('menu').classList.toggle('show')
})
`
### Version
1.12.4
### Browser
152.0.7977.83
### Before submitting
- [x] I will be polite and respectful. / 我会保持礼貌与尊重。
- [x] I have read the Code of Conduct. / 我已阅读行为准则。
- [x] I have searched existing issues and this is not a duplicate.
Contributor guide
Research direction
Start by running the reproducible HTML example from the issue and tracing page-agent's click-target selection for the nested avatar layers. Confirm the click reaches the element with the handler and that the menu toggles; add a regression test covering this multi-layer avatar structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100