Skip to content

Commit 90d76fb

Browse files
committed
Set color picker default value to black
I noticed that color picker HTML element retains the last picked value from user even after the page is reloaded. This will cause inconsistency between `color` value and the actual `colorEl.value`. This commit will always initialize color picker default value to black, the same way that `color` variable was set originally.
1 parent 2c455d2 commit 90d76fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drawing-app/script.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const ctx = canvas.getContext('2d');
99

1010
let size = 10
1111
let isPressed = false
12-
let color = 'black'
12+
colorEl.value = 'black'
13+
let color = colorEl.value
1314
let x
1415
let y
1516

0 commit comments

Comments
 (0)