pattern-library icon indicating copy to clipboard operation
pattern-library copied to clipboard

Input-Text React-18 can't edit text, cursor jumps to end

Open MarekLacoAXA opened this issue 3 years ago • 3 comments

Expected Behavior

  • type in text, move cursor back, can edit text in the middle or on the start
  • https://axa-ch-webhub-cloud.github.io/plib-feature/develop/?path=/story/examples-input-text-react--input-text

Current Behavior

  • when under React-18, cursor jumps to end of text after the keypress
  • probably because of a blur/focus cycle
  • all versions of axa-input-text are affected
  • only React-18 version is affected
  • (works with React-17)

Steps to Reproduce

  1. https://axa-ch-webhub-cloud.github.io/plib-feature/develop/?path=/story/examples-input-text-react--input-text
  2. type in text, move cursor back, type a char cursor jumps to end of text

Context (Environment)

  • Chrome/Windows

Possible Solution

MarekLacoAXA avatar Nov 11 '22 14:11 MarekLacoAXA

@MarekLacoAXA I have looked at it and already have a fix. But we should keep an eye on the input text afterwards to see if the fix has side effects or if there are other problems.

MKaHead avatar Nov 12 '22 10:11 MKaHead

Still reproducible when "typing quicky": can by simulated by pressing several (two/three) keys at once repeatedly on the begin of text. Cursor jumps to end. (browser-dependent, doesn't occur in Safari/MacOs, does on Chrome/Win).

MarekLacoAXA avatar Nov 16 '22 14:11 MarekLacoAXA

Just to mention: PRIOR fixing this issue (with the cursor jumping to the end in React-18): In the following browsers the text field was not unusable at all. The whole content was "randomly jumping" with each keypress: Apple: Safari/MacOs, Chrome+Safari/iOS+iPadOS.

MarekLacoAXA avatar Nov 18 '22 07:11 MarekLacoAXA