Skip to content

Commit

Permalink
Fixed Backspace not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro270707 committed Oct 30, 2023
1 parent c603883 commit 65c99b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/senha.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ function incrementSlot(amount) {

document.addEventListener("keyup", (event) => {
let key = event.key;
if (getSelectedCharacterSlot(true).classList.contains("locked")) return;
let selectedLetterCharacterSlot = getSelectedCharacterSlot(true);
if (selectedLetterCharacterSlot.classList.contains("locked")) return;
if (key === "Backspace") {
if (selectedCharacterSlot.classList.contains("locked")) return;
let shouldIncrement = getSelectedCharacterSlot(false).innerHTML === ' ';
if (selectedCharacterSlot) {
selectedCharacterSlot.innerHTML = ' ';
if (selectedLetterCharacterSlot) {
selectedLetterCharacterSlot.innerHTML = ' ';
}
if (shouldIncrement) {
incrementSlot(-1);
Expand Down

0 comments on commit 65c99b6

Please sign in to comment.