From 82ebc0ad198bc5c0bdc3508d0dad54ea33617db1 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 18 Apr 2020 18:51:23 +0100 Subject: [PATCH] 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. --- website/sandbox/learnpianochords/src/Preferences.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/sandbox/learnpianochords/src/Preferences.elm b/website/sandbox/learnpianochords/src/Preferences.elm index c0288e126..e385359b9 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 } ]