-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Delete emojis with several code points completely on "Backspace" press #52995
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
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!
✋ 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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