Description
Issue description
We identified a behavior change after promoted Anchorjs from v4.2.2 to v4.3.0.
We are using visible: touch
as anchor options. For v4.2.2
, the anchor is
hover
on page of Windows10
, after promoted to v4.3.0
, the anchor is
always
there instead of hover
.
Here are sample pages to help understand the issue:
v4.2.2 page(hover): https://kleisauke.github.io/net-vips-tests/api/NetVips.html
v4.3.0 page(always): https://kleisauke.github.io/net-vips/api/NetVips.html
Operating System: Windows
AnchorJs version: 4.3.0
Expected Behavior:
AnchorJS links only become visible when hovering over the headings like before for Windows when visible is touch.
Actual Behavior:
AnchorJS links are always visible for Windows when visible is touch.
Note:
This behavior change seems related to the newly added condition window.TouchEvent
in function isTouchDevice()
with this commit
isTouchDevice() for v4.3.0:
this.isTouchDevice=function(){return Boolean("ontouchstart"in window||window.TouchEvent||window.DocumentTouch&&document instanceof DocumentTouch)}
isTouchDevice() for v4.2.2:
,this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}