Firefox removes <hr> instead of <img> by pressing backspace
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 16.3k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
What is the current behavior? Describe the bug
In Firefox, hr-tags are removed that have nothing to do with the current selection.
Please provide the steps to reproduce and if possible a minimal demo of the problem via fiddle.tiny.cloud or similar.
- DOM structure: < p >Paragraph 1< /p >< hr >< p >Paragraph 2 < img > text< /p >
- Place the cursor directly behind the image (Range: startContainer: textNode (" text"), startOffset: 0)
- Press Backspace
Demo: http://fiddle.tiny.cloud/z7haab/2
What is the expected behavior?
Remove the img-tag.
I found out that the hr-tag is removed in the removeHrOnBackspace method, because it only checks if an hr-tag is in front of the current p-tag, instead of checking if it is in front of the current textNode.
Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE?
I can reproduce the behavior in all versions available on fiddle.tiny.cloud (okay ... I tested 4.x and above)
Tested on Windows 10, latest Firefox versions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the removeHrOnBackspace method and reproduce the issue in Firefox using the provided fiddle.tiny.cloud demo and DOM structure. Trace how the current paragraph and text node are identified during Backspace handling. Done means Backspace removes the img-tag directly after the cursor without removing the unrelated hr-tag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100