Fix selection of text when 3D touching a token on iOS
This commit is contained in:
parent
4e2d14e7ac
commit
78dac55d7a
@ -165,7 +165,14 @@ function TokenBar({ onMapTokensStateCreate }) {
|
||||
padding: "0 16px",
|
||||
}}
|
||||
>
|
||||
<Grid columns="1fr" gap={2} py={2}>
|
||||
<Grid
|
||||
columns="1fr"
|
||||
gap={2}
|
||||
py={2}
|
||||
// Prevent selection on 3D touch for iOS
|
||||
onTouchStart={preventSelect}
|
||||
onTouchEnd={resumeSelect}
|
||||
>
|
||||
{tokenGroups.map((group) => renderToken(group))}
|
||||
</Grid>
|
||||
</SimpleBar>
|
||||
|
@ -1,5 +1,14 @@
|
||||
function usePreventSelect() {
|
||||
function clearSelection() {
|
||||
if (window.getSelection) {
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
if (document.selection) {
|
||||
document.selection.empty();
|
||||
}
|
||||
}
|
||||
function preventSelect() {
|
||||
clearSelection();
|
||||
document.body.classList.add("no-select");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user