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

fix(VAutocomplete): update search value for mobile #15025

Merged
merged 2 commits into from
May 4, 2022

Conversation

tibnor
Copy link
Contributor

@tibnor tibnor commented May 1, 2022

Motivation and Context

VAutocomplete only filters complete waits for words to be completed on Android. The input of the inner VTextField of VAutocomplete is binded with a v-model. When using an android phone with autocomplete keyboard (GBoard) the value is first emitted when a word is completed. For instance if you write "House" v-model will first be updated when the word is completed and not on "H" -> "Ho" -> "Hou"... This means that VAutoComplete only filters on completed words.

Here is a codepen

Description

This pull request changes the databinding of VTextField in VAutoComplete from v-model into @input and :modelValue. @input is emitted on every key, while v-model waits for a word to be completed when using autocomplete on android keyboards.

How Has This Been Tested?

The code has been tested visually.

Markup:

<template>
  <v-autocomplete :items="items" />
</template>

<script>
  export default {
    name: 'Playground',
    data: () => ({
      items: [
        {
          value: 'foo',
          title: 'Foo',
        },
        {
          value: 'bar2',
          title: 'Foo',
        },
        {
          value: 'baz',
          title: 'Baz',
        },
      ],
    }),
  }
</script>

Types of changes

  • [ x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)

Checklist:

  • [ x ] The PR title is no longer than 64 characters.
  • [ x ] The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and backwards compatible changes and next for non-backwards compatible changes).
  • [ x ] My code follows the code style of this project.
  • [ x ] I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

Switch from using v-model to :value/@input for data binding
between VAutocomplete and inner VTextField
@KaelWD
Copy link
Member

KaelWD commented May 4, 2022

Weird vuejs/vue#9777 (comment)

Copy link
Member

@KaelWD KaelWD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably applies to combobox too

@tibnor
Copy link
Contributor Author

tibnor commented May 4, 2022

@KaelWD would you like the PR to include a fix for combobox to before you approve this PR?

@KaelWD
Copy link
Member

KaelWD commented May 4, 2022

Yes please

Switch from using v-model to :value/@input for data binding
between VCombobox and inner VTextField
@tibnor
Copy link
Contributor Author

tibnor commented May 4, 2022

@KaelWD: Here you are, now it is updated in VCombobox as well :-)

Copy link
Member

@KaelWD KaelWD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty

@KaelWD KaelWD merged commit 664aa8d into vuetifyjs:next May 4, 2022
@KaelWD KaelWD added this to the v3.0.0-beta milestone May 4, 2022
@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected C: VCombobox VCombobox C: VAutocomplete VAutocomplete labels May 4, 2022
@KaelWD KaelWD self-assigned this May 4, 2022
@tibnor tibnor deleted the fix/vautocomplete-update-on-mobile branch May 4, 2022 18:08
@yuwu9145
Copy link
Member

yuwu9145 commented Oct 23, 2023

I think this breaks the keyboard that's using IME composition model, e.g. Chinese keyboard

playground

Screen.Recording.2023-10-23.at.3.49.38.pm.mov

composition session events should be left to system keyboard to handle.

Also, I tried Gboard, maybe I missed something, but latest version Gboard doesn't have that underline composition suggestions anymore.

If this was true, this PR should be rolled back and consistently use v-model as it causes #18494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VAutocomplete VAutocomplete C: VCombobox VCombobox T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants