adactio / share-button-type

Other
17 stars 0 forks source link

Ideally, show how this works if JS fails... #2

Open bkardell opened 3 years ago

bkardell commented 3 years ago

Just summarizing our great discussion offline... I think we agreed it would be great to demonstrate in the explainer how this works if the js fails to download in the meantime. One way we said was to use a form with the target as a mailto:... This could definitely work. The other thing that I suggested is to decorate a link, and use fallback/composition here instead, something like..

<x-share><a href="mailto:...">Share this</a></x-share>

In both cases, I think, you wind up needing two elements (form+button or decorator+link) in order to be polyfilled or speculatively polyfiled. The latter doesn't risk stomping on a future potential native value speculatively in the interim which seems good... But, it comes with the admission that we haven't made polyfilling native elements beautiful either, so... tough. Somehow I think for authors the latter seems simpler, but that is entirely speculation based on not much more than the anecdotal observation that I've not seen many authors hesitant to use a link, but forms that actually work seem to be harder to convince people to use.

adactio commented 1 year ago

Just summarizing our great discussion offline... I think we agreed it would be great to demonstrate in the explainer how this works if the js fails to download in the meantime.

I’m a litte confused. If button type="share" were supported in a web browser, there would be no JavaScript to download.

I'm trying to understand where the JavaScript comes in.

Or do you mean that the polyfill should work without JavaScript? (Though I’m pretty sure that most polyfills don’t work if JavaScript fails.)