document-picture-in-picture icon indicating copy to clipboard operation
document-picture-in-picture copied to clipboard

Eyedropper API doesn't work in PiP on Chrome & Windows

Open adamchaboryk opened this issue 7 months ago • 4 comments

I realize this is very specific use case, but I'm using the EyeDropper API for my contrast checking tool in PiP mode, which works fine on Chrome (Version 135.0.7049.85 (Official Build) (arm64)) on Mac OS Sequoia 15.4.

Although on Windows 11 and Chrome 135.0.7049.42 (Official Build) (64-bit), the Eyedropper fails.

EyeDropper failed: AbortError: Failed to execute 'open' on 'EyeDropper': The user canceled the selection.

Error message in Chrome on Windows 11

adamchaboryk avatar Apr 15 '25 01:04 adamchaboryk

Code for reference:

  • https://github.com/adamchaboryk/contrast.report/blob/main/src/js/components/eyedropper.js
  • https://github.com/adamchaboryk/contrast.report/blob/main/src/js/components/picture-in-picture.js

adamchaboryk avatar Apr 15 '25 13:04 adamchaboryk

I tried this locally. As far as I can tell, eyedropper does that for all Windows windows, not just document pip. So I think this is not a document-pip-specific issue

steimelchrome avatar Apr 24 '25 17:04 steimelchrome

Actually I looked more into this and I think it's because I was using the devtools console to make the call, and in Chrome code (for Windows but not for Mac) it checks whether the calling window has focus, and so it failed for me since Devtools had focus.

Given that, my guess is that you're creating this eyedropper in the context of the opener window and not in the pip window context, so it's checking that the opener has focus while the pip window actually has focus

steimelchrome avatar Apr 24 '25 17:04 steimelchrome