简体   繁体   English

Safari Mac 上的 MouseLeave 事件在错误条件下触发

[英]MouseLeave Event on Safari Mac is triggered under wrong conditions

according to根据

https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseleave_event https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseleave_event

mouseleave is fired when the pointer has exited the element and all of its descendants.当指针退出元素及其所有后代时触发 mouseleave。

However, on Safari this event is fired as soon the mouse enters the element and is moved inside of it.但是,在 Safari 上,一旦鼠标进入元素并在其中移动,就会触发此事件。 I created a fiddle我创造了一个小提琴

 document.getElementById('out').addEventListener('mouseleave', () => console.log('left'));
 .outer { width: 100px; height: 100px; background-color: green; } .inner { width: 50px; height: 50px; background-color: red; }
 <div class="outer" id="out"> <div class="inner"> </div> </div>

https://jsfiddle.net/hs5ea7cq/ https://jsfiddle.net/hs5ea7cq/

document.getElementById('out').addEventListener('mouseleave', () => console.log('left'));

On Chrome, FireFox on Mac it works as it should.在 Chrome 上,Mac 上的 FireFox 可以正常工作。 However, Safari emits mouseleave even so it should not.但是,Safari 会发出 mouseleave,即使它不应该发出。

Is there anything I can do to get the same behavior in Safari as in Chrome or FireFox?我可以做些什么来在 Safari 中获得与在 Chrome 或 FireFox 中相同的行为吗?

EDIT:编辑:

I created a GIF which shows the issue:我创建了一个显示问题的 GIF:

https://imgur.com/a/G2csKmo https://imgur.com/a/G2csKmo

It seems to be related to TigerVNC usage.这似乎与 TigerVNC 的使用有关。 Switching to UltraVNC resolved the issue.切换到 UltraVNC 解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM