Allow deselecting a chosen problem card by clicking it again
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start at the landing page code that renders the “Choose a specific problem instead” section and handles problem card clicks. Trace how the selected problem is stored and how the default recommended problem is chosen. Toggle the current selection off on a second click while keeping the section open; done when selecting a card and clicking it again restores the default.
Written by the indexing model from the issue text.
Description
Reproduction
Tested at commit 8394d54 (or current main):
- Navigate to the lobby page.
- In the problem picker, click any problem card (e.g.,
template-delimiter-audit). The card is marked as selected, settingmanualProblem = true. - Click the same problem card again.
- Observed: The card remains permanently locked as manually selected; clicking it again re-selects it and does not release the manual override to revert to the default recommendation engine without reloading the page or clicking random.
- Expected: Clicking the active card toggles off the manual selection, clearing
manualProblemandkeptDraw, and re-triggersrecommend()ifhistoryReadyis true (or callssetProblem(null)if not), releasing the manual override.
Proposed Change
Update the problem card click handler in web/app.js (lines 246–254) to release the manual selection the way a difficulty or filter change already does (web/app.js:288-300, :1023-1033). When clicking an already selected card, clear manualProblem and keptDraw together, then invoke recommend() if history is ready and setProblem(null) if it is not:
for (const card of cards) {
card.button.addEventListener("click", () => {
if (manualProblem && problem === card) {
manualProblem = false;
keptDraw = null;
if (historyReady) {
recommend();
} else {
setProblem(null);
}
return;
}
manualProblem = true;
setProblem(card);
setDuration(suggestedDuration(new Set([card.difficulty])));
nodes.recommendation.textContent = `Selected problem: ${title(card)}.`;
});
}
Orthogonality with #394
Issue #394 refactors DOM structure by moving details.problem-picker below setup panels and adjusting .lobby .problem-grid in web/styles.css. Because card event binding in web/app.js queries [data-problem] buttons directly and operates on problem, manualProblem, and keptDraw state flags, this toggle logic is completely independent of the DOM hierarchy and layout adjustments in #394.
Test Plan
Add browser-level Playwright tests in tests/browser/lobby.test.js:
- Verify clicking an unselected
.problem-cardsets manual selection (manualProblem = true) and updates the prompt toSelected problem: .... - Verify clicking the same active card releases the manual override (
manualProblem = false,keptDraw = null). - Verify that releasing the manual override triggers
recommend()and allows the recommendation engine to choose the next problem (including the case where the recommendation lands on the same card). - Verify starting an interview launches with the currently assigned problem (
?problem=...), whether chosen manually or via automatic recommendation.
- Dominant language
- Rust
- Stars
- 177
- Forks
- 100
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 209
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sysprog21/codetrial
-
Audio output can be confirmed without playing a test soundPossibly taken @ChenYingHan1121 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
sysprog21/codetrial#359 · 5 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Add a Copy code button to the final reportPossibly taken @yansawu claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
sysprog21/codetrial#318 · 6 comments · 2 reactions · 1 assignee ·
Maintainers usually reply within 1 day
-
Add text objects to whiteboard and example drawingPossibly taken @Ethan921001 claimed this today. Open
sysprog21/codetrial#487 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Navigate to editor lines from compiler diagnosticsPossibly taken @yujoulai claimed this 1 day ago. Open
sysprog21/codetrial#486 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Add an opt-in shortcut to format JavaScript code in the editorPossibly taken @webdevbyjasmine claimed this today. Open
sysprog21/codetrial#485 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in sysprog21/codetrial
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
manuscript-lang/manuscript#1364 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fable-compiler/Fable#5157 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
C-bug needs-triage O-UEFI T-libs
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day