Bug: [Firefox] Removing an element with contentEditable="true" within an iframe and an RTL selection causes an exception
selecting from right to left inside an element that is inside an iframe and the iframe is removed it cause an exception
React version:
Steps To Reproduce
component:
const ElementWithTheException = () => {
const [ show, setShow ] = useState(true);
useEffect(() => {
setTimeout(() => {
setShow(false);
}, 5000);
});
return <div>
{show ? <iframe src="about:blank" srcDoc='<html><body contentEditable="true">lorem ipsum</body></html>'></iframe> : <p>abc</p>}
</div>;
};
- in Firefox
- select from right to left
lorem ipsum(or part of it) - wait 5 seconds
- look at the console
Link to code example:
- open https://codesandbox.io/s/inspiring-volhard-lctcsx in Firefox
- select from right to left
lorem ispumor part of it - wait
The current behavior
it raise an exception
The expected behavior
it should not raise an exception
NOTE: I did some debug:
- The exception is thrown by this selection.extend in
setOffsets. - Which is called by setSelection because in this case, the body does not have
selectionStart - Which is called by restoreSelection and this is because isInDocument refers to the document of the element so, in this case, the document itself is contained in the element that is removed
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
The bug seems still present to me, and considering @nawfelsekrafi comment I'm not the only one affected by it, there is something that I can do to help you with it?
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump