[Dropdown] multiselect values encoding, label cannot be removed, quotes missing in select dropdown#1770
Merged
lubber-de merged 4 commits intofomantic:developfrom Nov 16, 2020
Conversation
prudho
approved these changes
Nov 16, 2020
Contributor
prudho
left a comment
There was a problem hiding this comment.
Woa, good catch ! This one was a nasty bug.
LGTM 👍
ColinFrick
approved these changes
Nov 16, 2020
This was referenced Mar 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a multiple dropdown (non select) was used and selected data has characters like
&or'set, there were stored entity encoded (returning into false positives when comparing later to their original values). Even worse this was only done for all previous selected values, the current to be added value was kept raw already. dropdowns using select tags do not store the selected data in an input field, so the issue does not happen there.Original data should be kept, as it is already the case for dropdown made out of select tags. Also SUI does not do this.
Additionally this PR fixes a situation when a value has double quotes which led to a js error when trying to remove that label .
Double quotes in select menus are now also kept encoded instead of being removed to have the same behavior for select/non select dropdowns
Testcase
Item 3" incheslabel in the first dropdownWrong
Item 3" incheslabel results in a console syntax error"inside the Item 3 label anymorehttps://jsfiddle.net/lubber/fL56791d/13/
Correct
Item 3" incheslabel can be removed"https://jsfiddle.net/lubber/fL56791d/15/
Screenshots
To see the difference look at the elements console for the hidden input tag holding the selected data. Each time a selected value is added the previous values are encoded.
The second dropdown is made out of a selected tag which works fine already
Wrong
Correct
Closes
#1373