Skip to content

Commit

Permalink
Merge pull request #30085 from AmjedNazzal/Issue28820
Browse files Browse the repository at this point in the history
Fix - mWeb/Safari- Chat - After tapping on "Copy to clipboard", options menu does not close #28820
  • Loading branch information
tgolen authored Oct 31, 2023
2 parents 99a7150 + 82bf64e commit 9dc6e25
Showing 1 changed file with 3 additions and 1 deletion.
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) {
// 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

0 comments on commit 9dc6e25

Please sign in to comment.