-
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
[HOLD for payment 2023-06-01] [$4000] Paste H1(# test) message in chat causes incorrect line breaks #16921
Comments
Triggered auto assignment to @Christinadobrzyn ( |
Bug0 Triage Checklist (Main S/O)
|
I can replicate this and I think it's good to go external. Adding |
Job added to Upwork: https://www.upwork.com/jobs/~015e2698490538f13d |
Current assignee @Christinadobrzyn is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @0xmiroslav ( |
Triggered auto assignment to @NikkiWines ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.When we copy h1 text manually (Ctrl+C) and paste it to composer, the formatting/markdown is lost. What is the root cause of that problem?The problem is similar to #16525 but not the same. App/src/libs/SelectionScraper/index.js Lines 133 to 139 in 2f922c4
But in this case we use BaseHTMLEngineProvider and provide custom styling so it generates <h1> with a <div> insideApp/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js Lines 69 to 76 in 669970b
When we use Ctrl-C CopySelectionHelper calls App/src/components/CopySelectionHelper.js Lines 29 to 41 in 669970b
What changes do you think we should make in order to solve the problem?To avoid this we should get rid of additional empty pre: inputString => inputString.replace(/<(h1)><div>(.*)<\/div>(<\/\1>)/gi,'<$1>$2$3'), |
There's more to it. If you skip the edit part and just copy the message, it copies the emojis too. |
@Arslaan0124 the issue with emojis is a known bug and is being handled in this issue |
ProposalPlease re-state the problem that we are trying to solve in this issue.Copying H1 message using triple click is adding a new line after # What is the root cause of that problem?When we triple click and Ctrl C, the text that's copied is this Why is there the extra
The So the root cause here is the extra What changes do you think we should make in order to solve the problem?We should ignore the The div that's relevant to us will have the So we can ignore that div that:
It turns out we're already doing very close to that here App/src/libs/SelectionScraper/index.js Line 105 in 3abe7b2
div that has 1 single text child, which leads to this issue.
To fix this we just have to remove the App/src/libs/SelectionScraper/index.js Line 105 in 3abe7b2
Updates from here Feel free to double check thoroughly on your end. My take is: Any text-wrapping div/HTML element that is relevant to us will have the If we want to limit that logic to inside our markdown tags only (the tags that have What alternative solutions did you explore? (Optional)
|
@NikkiWines, @Christinadobrzyn, @0xmiroslav Eep! 4 days overdue now. Issues have feelings too... |
I think we're still collecting proposals |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Hey @0xmiroslav would you be able to review the provided proposals to see if they will work or if we need to seek others? Thanks! |
@0xmiroslav just checking in to see if you have an update on the proposal review! |
Proposals are in review. Will post update today |
@rzvc I don’t think having ‘div’ inside ‘h1’ is a common (or recommended) case in other web pages, and we shouldn’t have to patch our code based on other sites’ malformed HTML |
@0xmiroslav That is not the case. The proof of concept was a way for me to understand and explore the problem, the actual solution would be/look a lot simpler. (edit: maybe not a lot, IDK, didn't write it yet) Also, I don't think it's particularly complex even as it is, it's an "unwrapping" implementation, which is something that's often necessary when simplifying HTML. @tienifr DIVs inside H1s are perfectly valid HTML, and also used quite often (to convey subtext usually). So given it's standard HTML, I don't think the expectation of handling VALID input from other sources is outlandish. Choosing to modify existing HTML at copy time, in order to hide this issue is questionable at best tho. You can look at this issue from any angle you want, but my solution is still the only correct one. As I said tho, it's not my decision, but I felt compelled to point out what it's otherwise obvious to me. |
@rzvc please see this thread. div inside h1 is poor web design https://www.quora.com/Is-the-usage-of-DIV-within-an-H1-tag-bad-for-SEO-If-yes-why. Although it won’t throw an error, it’s bad practice from a HTML standpoint , so I doubt anyone would intentionally design the HTML that way, unless it’s a constraint of a library/other issues. |
@tienifr so then you agree that it's not malformed as you claimed, and in fact standard. |
@NikkiWines if you and @0xmiroslav are aligned here, shall I start with the PR or wait until assignment? Thanks! |
Oops, yes sorry - meant to assign you earlier @tienifr. Updated! |
Hired in Upwork - External job posting here - https://www.upwork.com/jobs/~015e2698490538f13d
|
@NikkiWines, @Christinadobrzyn, @0xmiroslav, @tienifr Whoops! This issue is 2 days overdue. Let's get this updated quick! |
working on the PR - #19030 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.17-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-06-01. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
No regressions so it looks like we're at pay day! 🎉 Paid jobs in upwork - #16921 (comment) @0xmiroslav can you let me know if you think a regression test is needed for this? I assume yes? |
It's tough to find out offending PR which caused regression. I think the issue always existed after implement copy selection scrapper and heading1 markdown. Regression Test Proposal
|
Thanks @0xmiroslav I'll send this over to QA and note your research on the offending PR just in case they need anything else. Closing this out! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Copying H1 message should not add a new line after #, and it should be the same as the original message
Actual Result:
Copying H1 message using triple click is adding a new line after #
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.94-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Recording.131.mp4
h1-tag-bug.mov
Expensify/Expensify Issue URL:
Issue reported by: @jayeshmangwani
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1680592375624629
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: