lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.2k stars 1.77k forks source link

"Copy Image" to clipboard no working in Chrome/Edge. (But correct in IE). #675

Open scottieGGGG opened 4 years ago

scottieGGGG commented 4 years ago

What version of Lightbox2 you are using? Found while using v 2.10.0, but confirmed on package's website using latest.

Which browsers and operating systems have you seen the issue on? Windows 10 Chrome 78.0.3904.97 Edge Beta Version 79.0.309.18 (Official build) beta (64-bit)

Note: The bug is NOT reproducible with IE 11 (v11.775.17763.0)

What are the steps to reproduce the bug? From Chrome / Edge:

Do you have link to a live site where the bug is visible? or can you post relevant HTML, CSS, and Javascript? Visible on package's demo page (https://lokeshdhakar.com/projects/lightbox2/)

scottieGGGG commented 4 years ago

There is a comment block within the .js file that indicates a work around is (was?) working for this issue, but perhaps that work around is no longer working?

From lightbox.js

  Show context menu for image on right-click

  There is a div containing the navigation that spans the entire image and lives above of it. If
  you right-click, you are right clicking this div and not the image. This prevents users from
  saving the image or using other context menu actions with the image.

  To fix this, when we detect the right mouse button is pressed down, but not yet clicked, we
  set pointer-events to none on the nav div. This is so that the upcoming right-click event on
  the next mouseup will bubble down to the image. Once the right-click/contextmenu event occurs
  we set the pointer events back to auto for the nav div so it can capture hover and left-click
  events as usual.