Delete emojis with several code points completely on "Backspace" press#52995
Conversation
| } | ||
|
|
||
| // Grapheme segmentation is same for English and Spanish. | ||
| const splitter = new Intl.Segmenter(CONST.LOCALES.EN, {granularity: 'grapheme'}); |
There was a problem hiding this comment.
I used Intl.Segmenter instead of grapheme-splitter because we are already using Intl namespace object in out repo. As per mdn, Intl.Segmenter works on all latest browsers and devices now.
|
|
||
| // Wales flag has 14 UTF-16 code units. This is the emoji with the largest number of UTF-16 code units we use. | ||
| const start = Math.max(0, selection.start - 14); | ||
| const graphemes = Array.from(splitter.segment(lastTextRef.current.substring(start, selection.start))); |
There was a problem hiding this comment.
Splitting only a few code units of the text, so I think there should not be any performance degradation.
|
@eVoloshchak 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] |
|
@eVoloshchak , gentle bump! |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-01-06.at.03.05.06.movAndroid: mWeb ChromeScreen.Recording.2025-01-06.at.03.07.37.moviOS: NativeScreen.Recording.2025-01-05.at.09.34.25.moviOS: mWeb SafariScreen.Recording.2025-01-05.at.09.39.59.movMacOS: Chrome / SafariScreen.Recording.2025-01-05.at.09.29.07.movMacOS: DesktopScreen.Recording.2025-01-06.at.03.10.14.mov |
|
@c3024, could you please merge with the latest |
|
@eVoloshchak , done. Please have a look! |
|
✋ 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/Gonals in version: 9.0.82-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/Gonals in version: 9.0.82-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.82-12 🚀
|
Explanation of Change
Pressing backspace does not remove some emojis (like Wales flag) completely on web browsers. This PR fixes that.
Fixed Issues
$ #51336
PROPOSAL: #51336 (comment)
Tests
Offline tests
Same as Tests.
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.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 and/or tagged@Expensify/designso 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
graphemeAndroid.mov
Android: mWeb Chrome
Screenrecorder-2024-11-23-17-49-33-862.mp4
iOS: Native
graphemeiOS.mov
iOS: mWeb Safari
RPReplay_Final1732364221.MP4
MacOS: Chrome / Safari
graphemeChrome.mov
graphemeSafari.mov
MacOS: Desktop
graphemeDesktop.mov