Pasting plain text over existing data fails in Firefox #3475
Labels
browser:firefox
The issue can only be reproduced in the Firefox browser.
regression
This issue is a regression.
status:confirmed
An issue confirmed by the development team.
target:minor
Any docs related issue that can be merged into a master or major branch.
type:bug
A bug.
Milestone
Type of report
Bug
Provide detailed reproduction steps (if any)
Expected result
The selected text is replaced with the clipboard contents
Actual result
An
IndexSizeError
is thrown usually. When stepping through with the dev tools, it instead inserts the clipboard contents just before the selection, without removing it.Cause
I think there are a couple of issues here. The first is that the Firefox-specific error handed in
selection.selectRanges
no longer matches because they have replaced it with a more user-friendly error string. Fixing this error means that the behaviour when stepping through with the dev tools (inserting the clipboard contents just before the selection rather than replacing it) occurs instead.That Firefox error is caused by trying to call
Range.setEnd
(on a native range) with an outdated reference to the end container, I think from before the container was split to move the selected content into its own TextNode. That means that endIndex is > TextNode.length, so it is a nonsense range and the exception is triggered.I've been trying to debug the issue further, but because it behaves differently when breakpoints are used I haven't been able to figure out more than that.
Other details
The text was updated successfully, but these errors were encountered: