about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-04-18T17·51+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-04-18T17·51+0100
commit82ebc0ad198bc5c0bdc3508d0dad54ea33617db1 (patch)
tree9183cbc6091defb637d1908182937c86e19d9e8a
parent441fe3e32eb9c041515178f74564ede9fd24db72 (diff)
Debug unresponsive button press for selectKey
Observed problem: Tapping "C major, A minor" key, which LPC sets by default,
does not unset it.

Bug: handleClick passed the relativeMinor Key but the default value in
State.Model is the C Major key. We would toggled b/w [Cmajor] ->
[Cmajor,Aminor], and because toggled checked if either Cmajor or Aminor was
present, it was always true.

Solution: Check relativeMajor to set toggled.
-rw-r--r--website/sandbox/learnpianochords/src/Preferences.elm4
1 files changed, 2 insertions, 2 deletions
diff --git a/website/sandbox/learnpianochords/src/Preferences.elm b/website/sandbox/learnpianochords/src/Preferences.elm
index c0288e1265e7..e385359b9f43 100644
--- a/website/sandbox/learnpianochords/src/Preferences.elm
+++ b/website/sandbox/learnpianochords/src/Preferences.elm
@@ -28,9 +28,9 @@ selectKey model { relativeMajor, relativeMinor } =
     div [ class "flex pt-0" ]
         [ UI.textToggleButton
             { label = buttonLabel relativeMajor relativeMinor
-            , handleClick = State.ToggleKey relativeMinor
+            , handleClick = State.ToggleKey relativeMajor
             , classes = [ "flex-1" ]
-            , toggled = active relativeMinor || active relativeMajor
+            , toggled = active relativeMajor
             }
         ]