eyedropper-api icon indicating copy to clipboard operation
eyedropper-api copied to clipboard

Do we need EyeDropper instances?

Open annevk opened this issue 4 years ago • 9 comments

It seems this could just be a method on navigator or some such. Or perhaps a static method on EyeDropper if we wanted to namespace it. @domenic probably knows what's modern.

annevk avatar Sep 22 '21 16:09 annevk

I've always found that new TextEncoder() seems weird and when I saw this api this was the first thing that came to mind as well. I think maybe an extension to navigator could work?

jespertheend avatar Oct 21 '21 19:10 jespertheend

I kind of assumed there was going to be some statefulness to the EyeDropper, perhaps in future (or previous?) revisions of the proposal. If that's the case then sticking with a class makes sense.

If there's no state and this is purely a function, then window.showColorPicker() would be my recommendation (similar to window.showOpenFilePicker()).

domenic avatar Oct 21 '21 19:10 domenic

(FWIW, TextEncoder is that way for symmetry with TextDecoder, which has state.)

annevk avatar Oct 22 '21 05:10 annevk

@ipopescu93 What are your current thoughts?

As we're thinking about adding showPicker() to HTMLInputElement interfaces in https://github.com/whatwg/html/issues/6909 to let web developers programmatically open pickers for color, file, and temporal input elements, we would be happy to have some consistency between method names.

window.showColorPicker() would be nice indeed if states are not needed.

beaufortfrancois avatar Nov 10 '21 07:11 beaufortfrancois

It is expected that state is going to be added for future capabilities of the EyeDropper like: UI customization, restricting the selectable area, etc.

ipopescu93 avatar Nov 10 '21 17:11 ipopescu93

Why can't that be an options dictionary to the hypothetical showColorPicker function?

emilio avatar Nov 19 '21 11:11 emilio

it is already shipped, does any one think this will change any more?

jogibear9988 avatar Dec 15 '21 18:12 jogibear9988

It shipped in one browser only, I'm somewhat hopeful this can still be changed.

annevk avatar Dec 15 '21 18:12 annevk

Also see https://github.com/WICG/eyedropper-api/issues/35

zcorpan avatar Oct 16 '24 12:10 zcorpan