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

Ensure the caret is in a consistent position when syncing the Combobox.Input value #2568

Merged
merged 4 commits into from
Jun 30, 2023

Commits on Jun 30, 2023

  1. ensure the caret is at the end of the input, after syncing the value

    This will ensure the caret is always in a consistent location once the
    input value has synced. We will _not_ do this while the user is typing
    because changing the position while typing will result in odd results.
    
    Safari already kept the caret at the end, Chrome put the caret at the
    end but once you synced the value once the caret was in front of the
    text.
    RobinMalfait committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    c7a26e4 View commit details
    Browse the repository at this point in the history
  2. update changelog

    RobinMalfait committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    aab5dac View commit details
    Browse the repository at this point in the history
  3. add selection guards

    Ensure that we only move the caret to the end, if the selection didn't
    change in the meantime yet. For example when you have code like this:
    ```js
    <Combobox.Input onFocus={e => e.target.select()} />
    ```
    
    This will select all the text in the input field, if we just move the
    caret position without keeping this into account then we would undo this
    behaviour.
    RobinMalfait committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    a77783f View commit details
    Browse the repository at this point in the history
  4. add tests

    RobinMalfait committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    15c6439 View commit details
    Browse the repository at this point in the history