-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ComboboxControl: Simplify string normalization #60893
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
].join( '' ) }]`, | ||
'g' | ||
'gu' | ||
); | ||
|
||
export const normalizeTextString = ( value: string ): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW this function is used only in ComboboxControl
. Should we just inline it there?
Size Change: -99 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! Thank you, @tyxla!
ef9cd75
to
8aa81e9
Compare
8aa81e9
to
484a3d0
Compare
The react native e2e tests on iOS are consistently failing, I'll investigate and try different things out to see what's going on. |
fa16e0f
to
5431024
Compare
2e0e7e0
to
b56d28b
Compare
Okay, got it! Seems like Hermes doesn't support the Unicode character groups (yet), see:
Luckily, it supports the literal regex notation (flags in the first argument of the `RegEx constructor), so I've refactored to that. I've also added some comments to make it all clearer. @Mamaduka could you have another look when you get a chance? Thanks 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work tracking down the mobile issue, @tyxla!
What?
This PR simplifies the string normalization, performed on the user input of
ComboboxControl
.Why?
For simplicity, brevity, and better coverage of dash characters that we might have missed.
How?
We're using the dash punctuation character class
\p{Pd}
that covers the most explicitly listed characters.We're also moving all original characters to the unit test to ensure clarity, full backward compatibility, and better documentation that sets the right expectations.
Testing Instructions
All tests should still pass.
Testing Instructions for Keyboard
None
Screenshots or screencast
None