Fomantic-UI icon indicating copy to clipboard operation
Fomantic-UI copied to clipboard

[Dropdown] JavaScript error when adding to dropdwon while hideAdditions = false

Open kamalkemo opened this issue 6 years ago • 3 comments

Bug Report

when allowAdditions is true and hideAdditions is false , Javascript error occurs when clicking the new added label 2020-09-20_0-44-42

Steps to reproduce

  1. create a new dropdown with options { allowAdditions: true, hideAdditions: false}
  2. add a new option
  3. click the new added option
  4. see the error

Expected result

shouldn't get an error

Actual result

Uncaught TypeError: Cannot read property 'trim' of undefined

Testcase

http://jsfiddle.net/kamalkemo/bwhsrvdf/

Screenshot (if possible)

2020-09-20_0-44-42

Version

2.8.7

kamalkemo avatar Sep 19 '20 22:09 kamalkemo

The bug is caused because fomantic does:

  1. Handles click event and deletes user addition
  2. Handles forceSelection function and calls click again

The problem is when forceSelection calls click again user addition is already deleted by the first click event.

If forceSelection is set to false, no error is shown.

TheJltres avatar Sep 20 '20 09:09 TheJltres

Fixed by #1681

lubber-de avatar Sep 27 '20 09:09 lubber-de

Looks great , Thanks!

kamalkemo avatar Oct 18 '20 22:10 kamalkemo