DEV Community

ericwestt
ericwestt

Posted on

Event listener triggering outside of target element in mobile resolution (HTML)

I found what seems to be a bug, unless I'm missing something. And I was wondering if anyone here found something similar happening to them and what the fix could be. Also I really need to rule out that there's something I'm not seeing here and that it effectively is a bug. I had this happen on a project I was working on and I got to the point of creating a React project completely from scratch just to see if I could replicate it and of course I could. Then went on an made a simple .html file with a div and the error happened as well. I'm losing my mind here.

</head>
<body>
<div style="width: 300px; height: 300px; border: 1px solid green" onclick="alert('hi')"></div>
</body>

Alert pops up when clicking slightly outside of its container :(

I'm expecting alert only to pop up only when clicking on the area inside the green borders.

Top comments (1)

Collapse
 
ericwestt profile image
ericwestt

have a nice day