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
3 changes: 2 additions & 1 deletion src/libs/Clipboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ 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
// We are adding a check for anchorNode and focusNode to prevent null values from being passed to setBaseAndExtent as per recent changes in Safari
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are to add a comment, I think we should focus on:

  • why these values can become null in practice
  • that null values are disallowed by this API per the standard

The fact that Safari actually started enforcing that is the least important matter and the comment might get outdated once other implementors start enforcing these null-checks

selection.setBaseAndExtent(originalSelection.anchorNode, originalSelection.anchorOffset, originalSelection.focusNode, originalSelection.focusOffset);
}

Expand Down
Loading