Skip to content
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

Fix - mWeb/Safari- Chat - After tapping on "Copy to clipboard", options menu does not close #28820 #30085

Merged
merged 9 commits into from
Oct 31, 2023
4 changes: 3 additions & 1 deletion src/libs/Clipboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ function setHTMLSync(html, text) {

if (isComposer) {
firstAnchorChild.setSelectionRange(originalSelection.start, originalSelection.end, originalSelection.direction);
} else {
} else if (originalSelection.anchorNode && originalSelection.focusNode) {
AmjedNazzal marked this conversation as resolved.
Show resolved Hide resolved
// When copying to the clipboard here, the original values of anchorNode and focusNode will be null since there will be no user selection.
// We are adding a check to prevent null values from being passed to setBaseAndExtent, in accordance with the standards of the Selection API as outlined here: https://w3c.github.io/selection-api/#dom-selection-setbaseandextent.
selection.setBaseAndExtent(originalSelection.anchorNode, originalSelection.anchorOffset, originalSelection.focusNode, originalSelection.focusOffset);
}

Expand Down
Loading