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

Fixed autosuggest input with special characters #1443

Merged
merged 7 commits into from Jan 20, 2023
Merged

Conversation

aidamag
Copy link
Contributor

@aidamag aidamag commented Jan 17, 2023

Checklist
(Check off all the items before submitting)

  • Build process is done without errors and all tests pass in /lib directory.
  • Self-reviewed the code prior to submitting.
  • Meets accessibility standards.
  • Added/updated documentation to /website as needed.
  • Added/updated tests as needed.

Description
Special characters were transformed to regular expression so it was giving an error if they were invalid.
Added \ to escape the special characters. For example, if we write * in the input, internally the component will transform the value received to \* so it will be valid.
Added new test.

About the implementation, I have created a regular expression with the special characters that are giving error. Then I have converted it to string and created an array with each character. It is needed to remove the duplicate characters from the array because the function .toString() is literally converting the regular expression in a string without removing the characters /, [ and ] that are used to create de regular expresion (example, const a = /[a-z]/).

Screenshots
Created a new function to transform the value:
image

Closes #1416

@aidamag aidamag marked this pull request as ready for review January 19, 2023 10:34
@Jialecl Jialecl self-requested a review January 19, 2023 14:22
@Jialecl Jialecl self-assigned this Jan 19, 2023
@GomezIvann
Copy link
Collaborator

GomezIvann commented Jan 20, 2023

This is great stuff, Aida! 🚀

@Jialecl Jialecl merged commit 8b61ced into master Jan 20, 2023
@Jialecl Jialecl deleted the aida-fix-1416 branch January 20, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autosuggest option values not working properly
3 participants