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

MultiInput: change event wouldn't be fired when typed value is as same as the first token #6262

Closed
1 of 4 tasks
echowwww opened this issue Jan 10, 2023 · 3 comments · Fixed by #6390
Closed
1 of 4 tasks
Assignees
Labels
bug This issue is a bug in the code Medium Prio TOPIC RL

Comments

@echowwww
Copy link

Bug Description

If the second input has the same value as the first input, change event wouldn't be fired and user cannot press enter.

Expected Behavior

change event should be fired when user press enter or focus out the input field. In change event listener, user can then check for duplicated input or perform other actions.

Steps to Reproduce

  1. Go to ui5's office document and navigate to multi input component with token creation onChange
  2. enter Argentina and press enter to create a token
  3. enter Argentina again and press enter

Context

  • UI5 Web Components version: {v1.9.1}
  • OS/Platform: {MacOs}
  • Browser: {Microsoft Edge}
  • Affected component: {MultiInput}

Log Output / Stack Trace / Screenshots

{...}

Priority

  • Low
  • Medium
  • High
  • Very High

The priority indicates the severity of the issue. To set the appropriate priority consider the following criteria:

  • Breaks entire application or system - High or Very High
  • Accessibility issue - Medium or High
  • Functional issue - Medium or High
  • Visual issue - Low or Medium

Note: The priority might be re-evaluated by the issue processor.

@kineticjs
Copy link
Contributor

Hi @echowwww ,

Are you reproducing this on https://sap.github.io/ui5-webcomponents/playground/components/MultiInput/ ,
sample: "Multi Input and token creation onChange"?

I set a breakpoint and see that the "change" event is fired but the logic for keeping unique tokens only executes, as shown in the screenshot below:

duplicatetoken

Please comment if you are testing on a different sample.

@kineticjs kineticjs self-assigned this Jan 10, 2023
@echowwww
Copy link
Author

Yes, i use this on https://sap.github.io/ui5-webcomponents/playground/components/MultiInput/ ,
sample: "Multi Input and token creation onChange".
I set a breakpoint at line 5989. When enter second 'Argentina' and press enter, breakpoint is not triggered. The warning 'token already in list' not show neither.
The case only happens when the first and second inputs are same. If 'Argentina' is third input, everything works fine.
Just FYI, i use Microsoft Edge, latest version. Not sure whether it's relevant.

@kineticjs kineticjs added bug This issue is a bug in the code TOPIC RL Medium Prio and removed author action labels Jan 12, 2023
@kineticjs
Copy link
Contributor

Hi @SAP/ui5-webcomponents-topic-rl,

Can you please check this issue with handling of duplicate input texts in ui5-multiinput:

To reproduce:

  1. Open https://sap.github.io/ui5-webcomponents/playground/components/MultiInput/
    sample "Multi Input and token creation onChange"
  2. add a conditional breakpoint in the listener for the "change" event of ui5-multiinput of the same sample
    (see the attached screenshot above) with condition: console.log("change")
  3. Add twice the token "Argentina" without moving the focus away from the multiinput field
    Expected: The change event is fired (=>logged in the console) twice;
    and the second time the code should display the value state message 'token already in list'
    Actual: The change event is fired only once (for the first token only)

The issue seems to be related to the logic in the _handleChange function of ui5-input, which fires the "change" event only if a precondition with the previously entered value is in place.

@kineticjs kineticjs removed their assignment Jan 12, 2023
@MapTo0 MapTo0 self-assigned this Jan 30, 2023
MapTo0 added a commit that referenced this issue Jan 31, 2023
when the user types something then hits enter the value is
set to the input field value. If the user change the value
in the change handler, internals used to be not updated
correctly and prevented correct future firing of the change
event.

FIXES: #6262
@MapTo0 MapTo0 closed this as completed in 68ad562 Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug in the code Medium Prio TOPIC RL
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

3 participants