We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The <UnitControl> component does not escape the units used to build the firstCharacters regular expression, see
<UnitControl>
firstCharacters
gutenberg/packages/components/src/unit-control/index.tsx
Line 82 in 9a6958e
This causes the component to crash with RegExp syntax errors like Nothing to repeat when units are used that contain regex control characters.
Nothing to repeat
There is a escapeRegExp helper that I think could be applied to the first character value.
escapeRegExp
first
This looks to be a bug introduced in #39303.
UnitControl
<UnitControl value={value} onChange={onChange} units={[ { label: '+', value: '+', }, { label: '-', value: '-', }, ]} />
No response
Yes
The text was updated successfully, but these errors were encountered:
TimothyBJacobs
Successfully merging a pull request may close this issue.
Description
The
<UnitControl>
component does not escape the units used to build thefirstCharacters
regular expression, seegutenberg/packages/components/src/unit-control/index.tsx
Line 82 in 9a6958e
This causes the component to crash with RegExp syntax errors like
Nothing to repeat
when units are used that contain regex control characters.There is a
escapeRegExp
helper that I think could be applied to thefirst
character value.This looks to be a bug introduced in #39303.
Step-by-step reproduction instructions
UnitControl
in a block or any React environment with the following code.Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: