Fix ImageEnlarger: accessibility, modal re-entry, responsive images, MutationObserver perf#925
Conversation
…rc, and MutationObserver performance Co-authored-by: PythonSmall-Q <106425289+PythonSmall-Q@users.noreply.github.com>
|
@copilot 右上角的×底色是白色,他的底色应该和弹出框其他部分相同 |
Co-authored-by: PythonSmall-Q <106425289+PythonSmall-Q@users.noreply.github.com>
已在 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Shan Wenxiao <seanoj_noreply@yeah.net>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Shan Wenxiao <seanoj_noreply@yeah.net>
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="XMOJ.user.js">
<violation number="1" location="XMOJ.user.js:5808">
P1: The modal opens a stale image URL because the click handler captures `effectiveSrc` at bind time instead of reading the current source at click time.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| }); | ||
| img.addEventListener("click", (e) => { | ||
| e.stopPropagation(); | ||
| OpenImageModal(effectiveSrc); |
There was a problem hiding this comment.
P1: The modal opens a stale image URL because the click handler captures effectiveSrc at bind time instead of reading the current source at click time.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At XMOJ.user.js, line 5808:
<comment>The modal opens a stale image URL because the click handler captures `effectiveSrc` at bind time instead of reading the current source at click time.</comment>
<file context>
@@ -5792,17 +5792,20 @@ int main()
img.addEventListener("click", (e) => {
e.stopPropagation();
- OpenImageModal(img.currentSrc || img.src);
+ OpenImageModal(effectiveSrc);
});
}
</file context>
| OpenImageModal(effectiveSrc); | |
| OpenImageModal(img.currentSrc || img.src); |
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="XMOJ.user.js">
<violation number="1" location="XMOJ.user.js:5806">
P2: The modal opens a stale image URL because `effectiveSrc` is captured once instead of reading `img.currentSrc || img.src` when the image is clicked.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| img.title = "点击放大"; | ||
| img.addEventListener("click", (e) => { | ||
| e.stopPropagation(); | ||
| OpenImageModal(effectiveSrc); |
There was a problem hiding this comment.
P2: The modal opens a stale image URL because effectiveSrc is captured once instead of reading img.currentSrc || img.src when the image is clicked.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At XMOJ.user.js, line 5806:
<comment>The modal opens a stale image URL because `effectiveSrc` is captured once instead of reading `img.currentSrc || img.src` when the image is clicked.</comment>
<file context>
@@ -5792,17 +5792,18 @@ int main()
img.addEventListener("click", (e) => {
e.stopPropagation();
- OpenImageModal(img.currentSrc || img.src);
+ OpenImageModal(effectiveSrc);
});
}
</file context>
| OpenImageModal(effectiveSrc); | |
| OpenImageModal(img.currentSrc || img.src || effectiveSrc); |
::afterpseudo-element CSS; addtitletooltip instead<span>to<button>witharia-labelfor accessibilityimg.closest(".xmoj-image-modal")img.currentSrc || img.srcfor responsive image supportMutationObserverto iterate only over newly added nodesbackground: none; border: none; padding: 0to reset browser default<button>styles💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Summary by cubic
Adds a modal image viewer so users can enlarge images from thumbnails, addressing feedback in #924. Improves readability, accessibility, and performance on desktop and mobile.
Written for commit 259cc7a. Summary will update on new commits.