diff --git a/packages/react-aria/src/interactions/usePress.ts b/packages/react-aria/src/interactions/usePress.ts index bdd9a9869b4..a64bd8801bf 100644 --- a/packages/react-aria/src/interactions/usePress.ts +++ b/packages/react-aria/src/interactions/usePress.ts @@ -990,13 +990,7 @@ export function usePress(props: PressHookProps): PressResult { // touchAction: 'manipulation' is supposed to be equivalent, but in // Safari it causes onPointerCancel not to fire on scroll. // https://bugs.webkit.org/show_bug.cgi?id=240917 - style.textContent = ` -@layer { - [${PRESSABLE_ATTRIBUTE}] { - touch-action: pan-x pan-y pinch-zoom; - } -} - `.trim(); + style.textContent=`@layer{[${PRESSABLE_ATTRIBUTE}]{touch-action:pan-x pan-y pinch-zoom}}` ownerDocument.head.prepend(style); }, [domRef]); diff --git a/packages/react-aria/src/overlays/usePreventScroll.ts b/packages/react-aria/src/overlays/usePreventScroll.ts index 6ed499570d6..54f24d9a640 100644 --- a/packages/react-aria/src/overlays/usePreventScroll.ts +++ b/packages/react-aria/src/overlays/usePreventScroll.ts @@ -143,12 +143,7 @@ function preventScrollMobileSafari() { if (nonce) { style.nonce = nonce; } - style.textContent = ` -@layer { - * { - overscroll-behavior: contain; - } -}`.trim(); + style.textContent='@layer{*{overscroll-behavior:contain}}' document.head.prepend(style); let onTouchMove = (e: TouchEvent) => {