Any idea why onPress would not work in iframe? #2237
Unanswered
stefanprobst
asked this question in
Q&A
Replies: 1 comment 4 replies
-
so it looks like the import { useButton } from "@react-aria/button";
import { useRef } from "react";
import Frame, { FrameContextConsumer } from "react-frame-component";
export default function App() {
return (
<div>
<Frame>
<FrameContextConsumer>
{({ document }) => <FrameContent document={document} />}
</FrameContextConsumer>
</Frame>
</div>
);
}
function FrameContent({ document }) {
const buttonRef = useRef(null);
const { buttonProps } = useButton(
{
onPress() {
alert();
},
},
buttonRef
);
return (
<main>
<h1>Hello from iframe</h1>
<button
ref={buttonRef}
{...buttonProps}
onPointerDown={(e) => {
buttonProps.onPointerDown(e, document);
}}
>
Click me
</button>
</main>
);
} is there currently a built-in way to make |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
when a component using
@react-aria/button
is rendered in aniframe
viareact-frame-component
(e.g. like in the Netlify CMS preview pane), theonPress
event does not seem to do anything, while a regularonClick
seems to work fine. do you have any idea what could be going on here?the issue can also be reproduced with a this
create-react-app
setup:Beta Was this translation helpful? Give feedback.
All reactions