Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User should not be able to hit enter except on last letter #115

Open
philgresh opened this issue Sep 5, 2020 · 1 comment
Open

User should not be able to hit enter except on last letter #115

philgresh opened this issue Sep 5, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@philgresh
Copy link
Collaborator

Prevent user from hitting enter on mid-word inputs. Disallow hitting enter twice.

@philgresh philgresh added the bug Something isn't working label Sep 5, 2020
@timharding31
Copy link
Collaborator

I'm not sure that we need to limit the ability to hit enter mid-word, I've noticed it being helpful a couple times I noticed a typo in the beginning and went back to correct. The hitting enter twice bug appears fixed with in grid.jsx:

  const handleGuess = async (e) => {
    if (e && e.key === 'Enter') {
      let enteredInputs = [...document.getElementsByClassName('grid-item')]
        .filter(input => ([...input.classList].includes('selected-row') && input.value));
      let guess = null;
      if (enteredInputs.length === props.game.nextWord['length']) {
        guess = enteredInputs.map(input => input.value).join('');
      }
      if (guess) {
        await dispatch({
          type: 'addGuess',
          guess
        })
      }
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants