-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Open
Description
React version:
16.13.1
Steps To Reproduce
use createPortal will have click event attached to the DOM element automatically
import { createPortal } from "react-dom";
const Modal = ({ children, onClose, open }) =>
open &&
createPortal(
<div />,
document.getElementById("modal")
);
this snippet will add click event attached to the element with id = modal
please open chrome dev tool to check
Link to code example:
https://codesandbox.io/s/vibrant-kowalevski-7ginb?file=/src/App.js
The current behavior
click event is added on the element
The expected behavior
click event should not be added
EDIT
createPortal(
<h1>This is heading</h1>,
document.getElementById("modal")
);
The header is read by jaws (not sure about nvda) as
this is heading, heading level one, clickable