           gotContent: true
           content: envelopedContent
 
+    # Using the React onClick handler for the download button yielded odd behaviors
+    # in which the onClick handler got triggered multiple times and the default
+    # handler could not be prevented, presumably due to React's SyntheticEvent system.
+    # The solution here is to use standard browser event handlers.
+    @refs.download.addEventListener 'click', @confirm
+
+  componentWillUnmount: ->
+    @refs.download.removeEventListener 'click', @confirm
+
   filenameChanged: ->
     filename = @refs.filename.value
     @setState

        provider: @props.provider
      @props.dialog.callback metadata
      @props.close()
    else
      e?.preventDefault()
    return

  render: ->
    confirmDisabled = @confirmDisabled()

    # for modern browsers
    downloadAnchor = (a {
      href: '#'
      ref: 'download'
      className: (if confirmDisabled then 'disabled' else '')
      download: @state.downloadFilename
      onContextMenu: @contextMenu
    }, tr '~FILE_DIALOG.DOWNLOAD')

    # for Safari (or other non-modern browsers)
    downloadButton = (button {
      ref: 'download'
      className: (if confirmDisabled then 'disabled' else '')
    }, tr '~FILE_DIALOG.DOWNLOAD')

    (div {className: 'dialogTab localFileSave'},
      (input {type: 'text', ref: 'filename', value: @state.filename, placeholder: (tr "~FILE_DIALOG.FILENAME"), onChange: @filenameChanged, onKeyDown: @watchForEnter}),
      (div {className: 'saveArea'},
