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

Chips: Double letters when IME is enabled #2966

Open
suntel-nagamine opened this issue Sep 13, 2022 · 4 comments
Open

Chips: Double letters when IME is enabled #2966

suntel-nagamine opened this issue Sep 13, 2022 · 4 comments
Labels
Resolution: Help Wanted Issue or pull request requires extra help and feedback
Milestone

Comments

@suntel-nagamine
Copy link

suntel-nagamine commented Sep 13, 2022

Describe the bug

When I enable IME (Input Method Editor) to input Japanese characters, the same character is doubled.

chips_ime

Is it possible to use the compositionstart and compositionend events for input to control the text so that it is not doubled?

Amendment

Chips.vue:

  data() {
    return {
      id: UniqueComponentId(),
      inputValue: null,
      focused: false,
      focusedIndex: null,
      isComposing: false,  // add
    };
  },
  // add
  mounted() {
    this.$refs.input.addEventListener("compositionstart", () => {
      this.isComposing = true;
    });
    this.$refs.input.addEventListener("compositionend", () => {
      this.isComposing = false;
    });
  },
  // add end
    onKeyDown(event) {
      const inputValue = event.target.value;

      switch (event.code) {
        case "Backspace":
          if (
            inputValue.length === 0 &&
            this.modelValue &&
            this.modelValue.length > 0
          ) {
            if (this.focusedIndex !== null) {
              this.removeItem(event, this.focusedIndex);
            } else this.removeItem(event, this.modelValue.length - 1);
          }
          break;

        case "Enter":
          if (inputValue && inputValue.trim().length && !this.maxedOut && !this.isComposing) {  // change
            this.addItem(event, inputValue, true);
          }

          break;

Reproducer

No response

PrimeVue version

3.16.2

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Chrome 105

Steps to reproduce the behavior

No response

Expected behavior

No response

@suntel-nagamine suntel-nagamine added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Sep 13, 2022
@choimon
Copy link

choimon commented Jul 6, 2023

I'm also having the similar problem. When I enter a Korean word in the chips, the last letter of the word is doubled. for example, if I enter '한글' (two-letter word in korean), two words '한글', '글' chips get automatically added.

@ameryu716
Copy link

Same me. Unfortunately, it appears to be an IME unfriendly framework.
Although of course it is a great repository.

@a20246
Copy link

a20246 commented Apr 12, 2024

Same me.I think both #5001 and this issue are related to the spell input method.

@mertsincan mertsincan added Resolution: Help Wanted Issue or pull request requires extra help and feedback and removed Type: Bug Issue contains a bug related to a specific component. Something about the component is not working labels Dec 27, 2024
@mertsincan mertsincan added this to the Future milestone Dec 27, 2024
@github-project-automation github-project-automation bot moved this to Review in PrimeVue Dec 27, 2024
Copy link

Due to PrimeTek's demanding roadmap for PrimeVue and the limited bandwidth of the core team, this issue is available for anyone to work on. Make sure to reference this issue in your pull request. ✨ Thank you for your contribution! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Help Wanted Issue or pull request requires extra help and feedback
Projects
Status: Review
Development

No branches or pull requests

5 participants