document-picture-in-picture
document-picture-in-picture copied to clipboard
Eyedropper API doesn't work in PiP on Chrome & Windows
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.
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
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
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