downshift icon indicating copy to clipboard operation
downshift copied to clipboard

Controlled inputValue doesn't wait for accented characters on Mac

Open lourenci opened this issue 5 years ago • 7 comments

  • downshift version: 3.2.10
  • node version: 8.10.0
  • npm (or yarn) version: yarn 1.16.0

This problem only happens in Mac with dead keys keyboard (like Portuguese). In these keyboards the user has to press two keys to accent a word.

When controlling a inputValue, the component doesn't wait for a second word when pressing a dead key. This doesn't happen with the selectedValue prop.

image

I've changed the Kent Dodds example to simulate that.

lourenci avatar Aug 22 '19 16:08 lourenci

Yes, to reproduce this easily:

  • If you press option-e and then the character e you should get é but you get ´é instead.

weyert avatar Aug 27 '19 21:08 weyert

I think for this we might need to ignore the KeyboardEvent when isComposing is true as this used to indicate a composition is happening. See also: https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event

weyert avatar Aug 27 '19 21:08 weyert

please re-open this and submit a fix if any.

silviuaavram avatar Nov 27 '19 14:11 silviuaavram

Any update on this issue? I'm having the same issue here.

luis-f-lins avatar Mar 15 '21 16:03 luis-f-lins

Maybe this PR https://github.com/downshift-js/downshift/pull/993 will help fix it since it appears to be the same issue. @luis-f-lins can you create a PR?

silviuaavram avatar Mar 21 '21 12:03 silviuaavram

Hi, I'm having the same issue with Downshift version 6.1.7. Any update on this?

alexhoma avatar Nov 30 '21 14:11 alexhoma

Hi,

I found a workaround that worked in my use case but might not be valid for everyone.

I have a autocomplete component connected with an API. To make it work I sync the value via onInputValueChange to my state but I do not send it back to useCombobox trough the inputValue property. That way useCombobox is the one that manages the state and I still have the value to call my API. It is not perfect because I'll have searches done with characters like "^" or "¨" (even when debounce with slow typers) but it's at least functional.

I personally think that onInputValueChange should not be triggered when the input is "waiting" for the second key.

francisprovost avatar Jan 04 '22 22:01 francisprovost