Repository navigation
fix: keep /web problem statements clear of the problem switcher - #1073
Conversation
Deploying xmoj-script-dev-channel with
|
| Latest commit: |
2e6c748
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ce23b5b3.xmoj-script-dev-channel.pages.dev |
| Branch Preview URL: | https://fix-problem-switcher-overlap.xmoj-script-dev-channel.pages.dev |
Reviewer's GuideUIReserve measured space for the problem switcher in
ConfigurationBump the userscript and package versions to 4.0.7 for this fix.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Hey - I've found 1 issue
Fixed security issues:
- Cross-site scripting (XSS) via untrusted HTML/JS injection in web rendering sinks (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="XMOJ.user.js" line_range="3793-3794" />
<code_context>
});
document.body.appendChild(switcher);
+ const ReserveSwitcherSpace = () => root.style.setProperty("--xmoj-problem-switcher-width", switcher.offsetWidth + "px");
+ ReserveSwitcherSpace();
+ window.addEventListener("resize", ReserveSwitcherSpace, {signal: controller.signal});
}
}
</code_context>
<issue_to_address>
**Statement remains partly covered**
When the monochrome web font finishes loading after the switcher is measured, without a window resize, `ReserveSwitcherSpace` records the switcher’s fallback-font width at mount and only updates on window resize. When the web font changes the switcher’s width, the jumbotron margin stays too narrow and the switcher covers part of the statement.
Update the reserved space when the web font loads or when the switcher’s width changes.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: XMOJ.user.js:3794
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Update.json">
<violation number="1" location="Update.json:4014">
P2: This `4.0.7` entry was written by hand, but the repo's UpdateVersion automation owns version bumps and `Update.json` entries (see CLAUDE.md and README.md). Remove the manual version bump and its entry, and let the automation generate it, or add `//!ci-no-touch` if the manual bump is intentional.</violation>
</file>
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
| ], | ||
| "Notes": "No release notes were provided for this release." | ||
| }, | ||
| "4.0.7": { |
There was a problem hiding this comment.
P2: This 4.0.7 entry was written by hand, but the repo's UpdateVersion automation owns version bumps and Update.json entries (see CLAUDE.md and README.md). Remove the manual version bump and its entry, and let the automation generate it, or add //!ci-no-touch if the manual bump is intentional.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At Update.json, line 4014:
<comment>This `4.0.7` entry was written by hand, but the repo's UpdateVersion automation owns version bumps and `Update.json` entries (see CLAUDE.md and README.md). Remove the manual version bump and its entry, and let the automation generate it, or add `//!ci-no-touch` if the manual bump is intentional.</comment>
<file context>
@@ -4010,6 +4010,17 @@
],
"Notes": "No release notes were provided for this release."
+ },
+ "4.0.7": {
+ "UpdateDate": 1795356391705,
+ "Prerelease": true,
</file context>
d135d64 to
f779edc
Compare
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
View guided diff | Turn on auto-fix | Re-trigger cubic
Sourcery withdrew this approval because it has stopped reviewing this pull request.
|
Sourcery has withdrawn its approval of this pull request. It auto-reviews a pull request 5 times, and this push is past that limit, so the approval no longer reflects code Sourcery has read. Comment |
The /web problem view spans the full width (#app > div > .jumbotron), unlike the legacy page's centred container, so the fixed problem switcher covered the left edge of the statement once the window was narrow enough. Measure the switcher (with a ResizeObserver, so font loading, media queries and window resizes are covered) and give the jumbotron a matching left margin; the width is 0 while the switcher is hidden and is cleared on route change. Closes #1072 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JhQLfJB3LWW4vkNXK85xL1
6939462 to
f0c9676
Compare
What does this PR aim to accomplish?:
Closes #1072 — on the new
/webcontest problem pages, the fixed problem switcher covers the left edge of the problem statement.How does this PR accomplish the above?:
On the legacy pages the content sat in a centred container, leaving room on the left for the switcher. In the
/webapp, the problem view's.jumbotronspans the full width (live DOM:#app > div > .jumbotron > .xmoj-problem-body > .cnt-row), so the switcher sits on top of the statement.--xmoj-problem-switcher-widthon#app; aResizeObserveron the switcher re-measures it (font loading, media queries, viewport changes) and is disconnected when the route'sAbortControlleraborts#app .jumbotron { margin-left: var(--xmoj-problem-switcher-width, 0px); }(the variable is only set on problem pages) — the width is 0 when the switcher is hidden (e.g. the ≤768px rule in MonochromeUI), so nothing moves thenClearRoute()removes the variable when leaving the pageOne custom CSS rule is unavoidable here: Bootstrap has no class for clearing a fixed element of measured width.
Does this PR need a documentation update?:
No
Testing / not yet verified:
node --check XMOJ.user.jspasses; the 12 non-browser tests pass (same as ondev)/webproblem pages, so the classic pages should be unaffectedBy submitting this pull request, I confirm the following:
devfor XMOJ-Script,masterfor everything else).git rebase)/webpages)/webpages)🤖 Generated with Claude Code
https://claude.ai/code/session_01JhQLfJB3LWW4vkNXK85xL1
Summary by Sourcery
Keep
/webcontest problem statements clear of the fixed problem switcher across layout changes.Bug Fixes:
/webcontest pages.Enhancements:
Build:
Summary by cubic
Keeps
/webcontest problem statements clear of the fixed problem switcher that previously covered the left edge of the statement (#1072). Bumps the project and userscript version to 4.0.7.#app .jumbotron); aResizeObserverre-measures it whenever the width changes, including when fonts finish loading or a media query hides the switcher.Written for commit 2e6c748. Summary will update on new commits.