Switch to the pen when choosing a drawing color
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.shpassed 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.
https://github.com/user-attachments/assets/0342bf82-8684-4e9c-8414-2dfce4864ef2
After
Selecting a color activates Pen and draws in that color.
https://github.com/user-attachments/assets/38e04b2c-3ad0-4526-80bc-b0ebd4483fce
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.