developit/nectarine

Chrome extension and prompt dialogs

Closed this issue · 2 comments

Hi there,

I've been trying to fix the issue mentioned in PH thread for
nectarine-chrome. The problem was that the alert, prompt and
confirm popups are not displaying correctly in chrome extension on
some OS.

So I was injecting code in iframe to override those methods. It is easy
enough for alert, but I've hit a problem on prompt: like
confirm, it's an imperative method. You call it and have a return
value. Implementing a custom modal, I have to make it event based, I
can't stop the execution flow like native prompt and confirm do.

Would you mind if I made a wrapper for prompt and confirm in
nectarine codebase? Something that would allow to do :

confirm( "Really delete?" ).then( this.deleteIt );

That way, I could override this wrapper in my extension.

@oelmekki I'd actually prefer to just use the HTML dialog element. Was going to throw this in today - that would circumvent the issue entirely, and avoids us creating a hard dependency between the two (especially overriding confirm() with a different implementation).
Would just be basing it off this: https://jsfiddle.net/developit/eqos5p1t/

Awesome! 👍