Fix form error inconsistencies on detecting HTML tag#33793
Conversation
|
@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
| VALIDATE_FOR_LEADINGSPACES_HTML_TAG_REGEX: /<([\s]+[\s\w~!@#$%^&*(){}[\];':"`|?.,/\\+\-=<]+.*[\s]*)>/g, | ||
| VALIDATE_FOR_LEADINGSPACES_HTML_TAG_REGEX: /<([\s]+.+[\s]*)>/g, | ||
|
|
||
| WHITELISTED_TAGS: [/<>/, /< >/, /<->/, /<-->/, /<br>/, /<br\/>/], |
There was a problem hiding this comment.
Can you fix these too? They seem to be missing ^ and $.
| WHITELISTED_TAGS: [/<>/, /< >/, /<->/, /<-->/, /<br>/, /<br\/>/], | |
| WHITELISTED_TAGS: [/^<>$/, /^< >$/, /^<->$/, /^<-->$/, /^<br>$/, /^<br\/>$/], |
There was a problem hiding this comment.
If we add ^$, then it will fail to match <>a.
App/src/components/Form/FormProvider.js
Lines 145 to 157 in fe49e4f
It will return false in line 146, but eventually, it will be true inside the loop though.
There was a problem hiding this comment.
Lets leave this then
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-01-01.at.7.05.15.PM.movAndroid: mWeb ChromeScreen.Recording.2024-01-01.at.6.33.42.PM.moviOS: NativeScreen.Recording.2024-01-01.at.6.51.50.PM.moviOS: mWeb SafariScreen.Recording.2024-01-01.at.6.23.41.PM.movMacOS: Chrome / SafariScreen.Recording.2024-01-01.at.6.09.57.PM.movMacOS: DesktopScreen.Recording.2024-01-01.at.6.46.33.PM.mov |
|
@bernhardoj Typescript checks are failing |
|
@jasperhuangg fixed from main, but the unit testing fails on main too. |
|
There's a test failure here that needs to be addressed. |
|
Please merge again here. This will fix the test. |
|
@tylerkaraszewski @shubham1206agra Merged with main |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/jasperhuangg in version: 1.4.22-0 🚀
|
|
🚀 Deployed to staging by https://github.com/jasperhuangg in version: 1.4.22-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.22-6 🚀
|
Details
In Form, we will show an error if an HTML tag is found, but this doesn't work if the character between <> is an emoji.
Fixed Issues
$ #31391
PROPOSAL: #31391 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
<>. Verify the "Name can only include Latin characters." error message shows<a>and try to add space inside the tag<>(e.g.< a>). For every case, verify the "Invalid character" error message showsPR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2023-12-30.at.15.07.37.mov
Android: mWeb Chrome
Screen.Recording.2023-12-30.at.15.08.44.mov
iOS: Native
Screen.Recording.2023-12-30.at.15.05.35.mov
iOS: mWeb Safari
Screen.Recording.2023-12-30.at.15.06.56.mov
MacOS: Chrome / Safari
Screen.Recording.2023-12-30.at.15.03.41.mov
MacOS: Desktop
Screen.Recording.2023-12-30.at.15.04.37.mov