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

[useCombobox] InputKeyDownEnter action not triggering when focus is on the input field on version 6.1.0 #1234

Closed
lasota-piotr opened this issue Feb 10, 2021 · 1 comment

Comments

@lasota-piotr
Copy link

lasota-piotr commented Feb 10, 2021

  • downshift version: 6.1.0

  • node version: 14.2.0

  • yarn version: 1.22.10

Relevant code or config

function stateReducer(state, actionAndChanges) {
    const { type, changes } = actionAndChanges;
    // Doesn't log when a user has focused on the input and pressed enter
    console.log(actionAndChanges);
    return changes;
  }

What you did:

  1. I clicked on the input and typed hi
  2. I pressed enter

What happened:
It didn't log actionAndChanges variable

Reproduction repository:

https://codesandbox.io/s/usecombobox-inputkeydownenter-action-not-triggering-when-focus-is-on-the-input-field-lrtmr?file=/src/App.js

Problem description:
The problem is the same as here #1114 but on version 6.1.0. On version 6.0.4 works correctly.

@silviuaavram
Copy link
Collaborator

Should the state of the component change once you pass enter? If not, then stateReducer should not get called. Before #1218 it was broken, that's why you got that called.

https://github.com/downshift-js/downshift#statereducer

If you need to execute your own logic independent from downshift then use your own event handlers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants