-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix(27428): fix if we type enter anything followed by a \ in settings search #27432
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
8e04cf2
to
9f20d4f
Compare
Builds ready [9f20d4f]
Page Load Metrics (1816 ± 90 ms)
Bundle size diffs
|
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.
LGTM
4c36e9f
to
1f6301e
Compare
Builds ready [1f6301e]
Page Load Metrics (1884 ± 125 ms)
Bundle size diffs
|
Should we just use |
hey @davidmurdoch do you mean |
No. In the export function colorText(menuElement, regex) {
// ... omitted code ...
menuElement.innerHTML = elemText.replace(
regex,
'<span class="settings-page__header__search__list__item__highlight">$&</span>',
);
} used as: colorText(menuTabElement, searchRegex); but this could be simplified to something like: export function colorText(menuElement, textToColor) {
// ... omitted code ...
menuElement.innerHTML = elemText.replaceAll(
textToColor,
`<span class="settings-page__header__search__list__item__highlight">${textToColor}</span>`,
);
} used as: colorText(menuTabElement, searchElem.value); I don't think we even need to create a regular expression here. |
@davidmurdoch good suggestions ! However, i believe
|
1f6301e
to
3535156
Compare
Builds ready [3535156]
Page Load Metrics (1796 ± 69 ms)
Bundle size diffs
|
3535156
to
9417681
Compare
Builds ready [9417681]
Page Load Metrics (1715 ± 84 ms)
Bundle size diffs
|
Quality Gate passedIssues Measures |
In JavaScript, backslashes are used as escape characters in strings and regular expressions, which can cause issues when an unescaped backslash is present in a user input. To handle this, we'll need to escape any special characters in the user input before constructing the regular expression.
Description
Related issues
Fixes: #27428, #26945
Manual testing steps
Screenshots/Recordings
Before
After
regex-search.mov
Pre-merge author checklist
Pre-merge reviewer checklist