Skip to content

Switch to the pen when choosing a drawing color - #460

Merged
jserv merged 3 commits into
sysprog21:mainfrom
Aa99841:issue-437
Oct 25, 2026
Merged

jserv merged 3 commits into
sysprog21:mainfrom
Aa99841:issue-437

Conversation

@Aa99841

@Aa99841 Aa99841 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Selecting a pen color in Example drawing currently leaves Eraser active, so subsequent strokes keep erasing. Make color selection activate Pen and synchronize the tool and color buttons' aria-pressed states. Selecting Eraser preserves the chosen color for the next Pen stroke.

Add a browser regression test covering drawing, erasing, selecting a color, and drawing again. It checks the resulting stroke's color and width, toolbar selection, and preservation of the selected color when switching tools.

Validation

  • The same regression test fails against the upstream implementation at 82bbdc5: the next stroke uses the white eraser with width 24 instead of the selected red pen with width 3. It passes with the fix.
  • Manually verified that selecting a color while erasing activates Pen and draws in the selected color.
  • At 557e6c5, taskset -c 0-3 ./scripts/test.sh passed the complete gate with exit code 0: all 1741 Node tests passed without skips, and the remaining checks, including the dependency advisory scan, completed successfully. No tests were excluded, and no assertions or timeouts were changed.
  • Default-parallel runs on this WSL environment produced browser timeouts. The unmodified matching upstream base, 65cee24, also failed its default browser gate while waiting for a code update: 1739 tests passed and one timed out.
  • WSL reports 16 available CPUs, causing Node to run up to 15 test files concurrently. Limiting CPU affinity to four CPUs reduces this to three. These results support concurrency-sensitive test instability on this environment; they do not establish the exact cause of every timeout.

Before

Selecting a color leaves Eraser active.

test_before.mp4

After

Selecting a color activates Pen and draws in that color.

test_case.mp4

Closes #437


Summary by cubic

Selecting a drawing color while Eraser is active now switches to Pen, so the next stroke draws in the selected color instead of erasing. Tool and color buttons' aria-pressed states stay synchronized, and choosing Eraser still preserves the selected color for the next Pen stroke.

Adds a browser regression test covering drawing, erasing, picking a color, and drawing again. It verifies the resulting stroke's color and width, toolbar selection, and color preservation across tool switches.

Written for commit 557e6c5. Summary will update on new commits.

View guided diff

@jserv

jserv commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Regression evidence
The same test fails before the fix and passes afterward.

Don't include screenshots that contain only plain text.

@jserv
jserv requested review from ColtenOuO and alanhc October 24, 2026 08:13

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase latest main branch and explain how the CI result changes.

The gates (browser) failure here is Strict delayed judge language restoration respects end in tests/browser/strict-selection.test.js. This branch did not break it: the test was flaky on main itself. After End it waited for the ending overlay, but its room has no interviewer, so the offline summary replaced that overlay a moment later and a loaded runner missed the window. #461 (merge b0059b2) fixed the test by pausing a fake clock before End, and main passes the browser lane again at that commit. This branch is based on a commit before b0059b2, so it still runs the old test. After rebasing, reply here with the new CI result, and if anything still fails, say whether it comes from this branch or also fails on main.

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before asking someone to review, you MUST resolve any regressions flagged by GitHub Actions.

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase latest main branch.

The gates (browser) failure here is the lobby fits on one screen instead of a wall of problems (tests/browser/lobby.test.js). This branch did not cause it: the lobby overflowed the 800px viewport by 5px on CI fonts on main itself. #478 fixed that (trimmed the credits spacing in web/styles.css and hardened the test), so rebasing picks up the fix.

After the rebase, confirm gates (browser) is green. If it still fails on a different test, explain that failure in a comment.

Comment thread tests/browser/example-board-ui.test.js Resolved

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the changes look good to me.

Choosing a color while erasing leaves the eraser active, so drawing
still erases instead of using the selected color. Make selecting a
color return to the pen and keep the toolbar state consistent.
The existing regression test starts by selecting Eraser without
first drawing or erasing a stroke. Add those steps to match the
reported interaction and the requested reproduction sequence.

Verify that the extended test fails against the upstream board
implementation and passes with the fix. Production code is unchanged.
Check the initial color and red selection exclusively, so stale
pressed states on other colors cannot pass the browser test.
@jserv
jserv merged commit 4ee08b3 into sysprog21:main Oct 25, 2026
12 checks passed
@jserv

jserv commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Thank @Aa99841 for contributing!

@ColtenOuO

Copy link
Copy Markdown
Collaborator

Although this has already been merged, just a quick reminder that changes addressing review comments don't need separate commits, please just amend the previous commit and update the commit message accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selecting a pen color leaves Example drawing in eraser mode

3 participants