Allow deselecting a chosen problem card by clicking it again
维护者通常 1 天内回复
@woohsin 已经在做这个了。
开始于 2026年10月21日。
评估
调研方向
从负责渲染“改为选择一个具体问题”部分并处理问题卡片点击的落地页代码开始。追踪所选问题的存储方式,以及默认推荐问题的选择方式。第二次点击时取消当前选择,同时保持该部分展开;选择一张卡片后再次点击它即可恢复默认状态时,任务就完成了。
由索引模型根据 Issue 内容生成。
描述
Here is the detailed analysis of the current lobby selection flow and the consolidated proposal based on web/app.js.
1. Current Implementation Analysis
-
Event Listener & State (
web/app.js:246-254):
Inweb/app.js, cards are derived from[data-problem]buttons and initialized withmark(card.button, false). Clicking a card executes:for (const card of cards) { card.button.addEventListener("click", () => { manualProblem = true; setProblem(card); setDuration(suggestedDuration(new Set([card.difficulty]))); nodes.recommendation.textContent = `Selected problem: ${title(card)}.`; }); } -
The Issue:
The listener unconditionally setsmanualProblem = true, updatesproblem = card, marks the button viamark(card.button, true)insidesetProblem(), and updates the recommendation prompt. It does not check whethermanualProblem && problem === card. Clicking the active card re-applies the manual override. -
Fallback Behavior:
recommend(note = "", mode = "recommend")returns early without updating recommendation elements whenevermanualProblemis active. Currently, the only way a candidate can revert to the automatic recommendation engine is by clicking#random-problem(nodes.randomProblem), which resetsmanualProblem = falseand callsrecommend("", "random"), or by reloading the page.
2. Consolidated Proposal
-
Toggle Selection on Card Click:
Update the click handler inweb/app.jsto inspect whether the clicked card is already active (manualProblem && problem === card):-
When selecting a new card: Preserve the current behavior (
manualProblem = true,setProblem(card), update duration, and setnodes.recommendation.textContent). -
When clicking the currently selected card: Toggle it off by resetting
manualProblem = false, clearing the card mark viamark(card.button, false), clearing or resettingproblem = null, and invokingrecommend()to restore the default overdue/unseen recommendation and lobby controls.
for (const card of cards) { card.button.addEventListener("click", () => { if (manualProblem && problem === card) { manualProblem = false; mark(card.button, false); problem = null; recommend(); return; } manualProblem = true; setProblem(card); setDuration(suggestedDuration(new Set([card.difficulty]))); nodes.recommendation.textContent = `Selected problem: ${title(card)}.`; }); } -
-
Orthogonality with #394:
Issue #394 movesdetails.problem-pickerbelow the setup panels and adjusts.lobby .problem-gridinweb/styles.css. Because card event binding inweb/app.jsqueries[data-problem]buttons directly and operates onproblemandmanualProblemstate flags, this toggle logic does not depend on DOM hierarchy or CSS layout, making it completely orthogonal to and forward-compatible with #394.
3. Test Plan
Add browser-level Playwright tests in tests/browser/lobby.test.js:
-
Verify clicking a
.problem-cardapplies.selected, setsaria-pressed="true", and displays"Selected problem: ..."innodes.recommendation. -
Verify clicking the same active card removes
.selected, resetsaria-pressed="false", clearsmanualProblem, and restores the default recommendation prompt. -
Verify launching an interview after deselecting proceeds with the recommended practice problem without an explicit
?problem=query parameter.
- 主要语言
- Rust
- 星标
- 177
- 派生
- 100
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 151
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
Audio output can be confirmed without playing a test sound可能已有人在做 @ChenYingHan1121 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
sysprog21/codetrial#359 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Add a Copy code button to the final report可能已有人在做 @yansawu 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
sysprog21/codetrial#318 · 5 条评论 · 2 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
Outline Snapshot Duplicator question accept a copied random list that loops back into itself可能已有人在做 @papaya0112 今天认领。 未关闭
sysprog21/codetrial#417 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Add a live camera preview during the media preflight可能已有人在做 @ChenYingHan1121 今天认领。 未关闭
sysprog21/codetrial#414 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
rustls/rustls-platform-verifier#262 · 2 条评论 · 2 个 reaction ·
-
needs-triage
难度 2/5 1-3 小时 新手友好度 73/100
bherbruck/solvecraft#4493 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
IngvarConsulting/unica#1911 ·
维护者通常 1 天内回复
-
priority: low
难度 1/5 1 小时以内 新手友好度 90/100
storytold/photocraft#8325 ·
维护者通常 2 天内回复