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

Cursor moves to end of email input on Safari on input event #65

Open
StevenMeyer opened this issue Apr 1, 2021 · 3 comments
Open

Cursor moves to end of email input on Safari on input event #65

StevenMeyer opened this issue Apr 1, 2021 · 3 comments
Labels

Comments

@StevenMeyer
Copy link

Description
If one tries to edit a text input's value from the middle (or start) of the value the cursor is moved to the end position for the next input. This is only on Safari web browser.

Reproduction steps

  1. Open the playground using Safari
  2. Enter a value (such as [email protected])
  3. Move the cursor position to anywhere but the end (eg. before the @ symbol)
  4. Start typing more than one character

Expected outcome
The new text should be entered at the cursor position and the cursor position should only move with the new input

Actual outcome
The first character is entered at the cursor position. The cursor is moved to the end of the input.

@StevenMeyer
Copy link
Author

StevenMeyer commented Apr 1, 2021

This is a duplicate of #36, but is still happening for us.

@StevenMeyer
Copy link
Author

It's a problem with type="email" input elements. According to the spec these inputs don't have setSelectionRange() available.

A solution could be to, for email inputs only:

  • change the type to text
  • perform the setSelectionRange()
  • change the type back to email

If my organisation decides that temporarily using a fork is preferable to fixing our cause for needing trim I may submit this PR myself.

@StevenMeyer StevenMeyer changed the title Cursor moves to end of input on Safari on input event Cursor moves to end of email input on Safari on input event Apr 1, 2021
@anein
Copy link
Owner

anein commented Apr 8, 2021

That would be great!

@anein anein added the bug label Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants