Automattic / Automattic/harper
Applying suggestions removes/merges whitespace and misinterprets line breaks (false positives + formatting corruption)
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 102
Description
**Describe the bug**
When using the Harper Chrome extension, clicking/applying a suggestion corrupts text formatting by removing paragraph breaks or merging whitespace. Additionally, Harper frequently flags false errors because it does not correctly detect line breaks: words at the start of a new line are treated as if they directly follow the last word of the previous line.
**To Reproduce**
Steps to reproduce the behavior:
1. Open Chrome and enable the Harper Chrome extension.
2. Go to a web page with an editable text field that contains line breaks (e.g. Zendesk).
3. Enter or paste text with intentional line breaks (such as a multi-paragraph email).
4. Wait for Harper’s underlines to appear.
5. Click on one of the suggested corrections to apply it.
6. Observe that the resulting text has altered spacing or formatting.
**Expected behavior**
Applying a suggestion should modify only the intended token(s) and should not remove or merge surrounding whitespace. Line breaks should be respected as separators so that words at the beginning of a new line are not treated as directly adjacent to the end of the previous line.
**Screenshots**
Before applying Harper suggestion:
After applying Harper suggestion:
**Platform**
Zendesk website, Chrome browser, Mac OS
**Additional context**
This seems related to how the extension reads and replaces text in multiline or rich-text contexts (possibly normalization of whitespace/newlines or how the underlying DOM text nodes are concatenated and rewritten when a suggestion is applied).
Contributor guide
Research direction
Start by tracing the Harper Chrome extension's handling of editable fields, especially how DOM text nodes are read and rewritten when a suggestion is applied. Reproduce the Zendesk multiline case, then verify that applying a correction preserves surrounding whitespace and paragraph breaks and that line-start words are treated as separated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100