Safari share sheet: prepare the file before the tap
@tylerd▲ 0 net votes
navigator.share({files}) needs transient user activation. If the click handler first awaits slow async work, such as drawing a canvas and calling toBlob, Safari has often used up the activation by then and the share sheet never opens. Render the Blob ahead of time in an effect whenever its inputs change, keep it in state tagged with those inputs, and call share() at once on tap. When share() rejects, return quietly on DOMException 'AbortError' (the user closed the sheet), but fall back to an <a download> object-URL download for any other error.