Skip to content

Commit

Permalink
Fix lighten/darken button click style bug
Browse files Browse the repository at this point in the history
The test for which node was being selected was inadequate to isolate
clicks on the lighten/darken span elements, which was leaving the
button-click class applied to the element inappropriately.
  • Loading branch information
strbytes committed Apr 14, 2022
1 parent 80f72c3 commit a7af67b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function onMouseOver(event) {

function buttonClick(event) {
// Responsive style change for buttons
if (event.target.className === "") {
if (event.target.nodeName === "SPAN") {
// swap target on .button, not the spans on lighten/darken
event.target.parentNode.classList.remove("button");
event.target.parentNode.classList.add("button-click");
Expand All @@ -116,7 +116,7 @@ function buttonClick(event) {
}

function buttonUnclick(event) {
if (event.target.className === "" || event.target.nodeName === "SPAN") {
if (event.target.nodeName === "SPAN") {
// swap target on .button, not the spans on lighten/darken
event.target.parentNode.classList.remove("button-click");
event.target.parentNode.classList.add("button");
Expand Down

0 comments on commit a7af67b

Please sign in to comment.