Browse Source

Buttons should have type="button", otherwise they submit forms :scream_cat:

Artur Paikin 7 years ago
parent
commit
ba405dba13

+ 2 - 0
src/plugins/Dashboard/Dashboard.js

@@ -58,6 +58,7 @@ module.exports = function Dashboard (props) {
           onload=${() => props.updateDashboardElWidth()}>
 
     <button class="UppyDashboard-close"
+            type="button"
             aria-label="${props.i18n('closeModal')}"
             title="${props.i18n('closeModal')}"
             onclick=${props.hideModal}>${closeIcon()}</button>
@@ -134,6 +135,7 @@ module.exports = function Dashboard (props) {
               ${props.i18n('importFrom')} ${props.activePanel ? props.activePanel.name : null}
             </h2>
             <button class="UppyDashboardContent-back"
+                    type="button"
                     onclick=${props.hideAllPanels}>${props.i18n('done')}</button>
           </div>
           ${props.activePanel ? props.activePanel.render(props.state) : ''}

+ 1 - 1
src/plugins/Dashboard/FileCard.js

@@ -29,7 +29,7 @@ module.exports = function fileCard (props) {
   return html`<div class="UppyDashboardFileCard" aria-hidden="${!props.fileCardFor}">
     <div class="UppyDashboardContent-bar">
       <h2 class="UppyDashboardContent-title">Editing <span class="UppyDashboardContent-titleFile">${file.meta ? file.meta.name : file.name}</span></h2>
-      <button class="UppyDashboardContent-back" title="Finish editing file"
+      <button class="UppyDashboardContent-back" type="button" title="Finish editing file"
               onclick=${() => props.done(meta, file.id)}>Done</button>
     </div>
     ${props.fileCardFor

+ 4 - 0
src/plugins/Dashboard/FileItem.js

@@ -49,6 +49,7 @@ module.exports = function fileItem (props) {
         </div>
         <div class="UppyDashboardItem-progress">
           <button class="UppyDashboardItem-progressBtn"
+                  type="button"
                   title="${isUploaded
                           ? 'upload complete'
                           : props.resumableUploads
@@ -97,6 +98,7 @@ module.exports = function fileItem (props) {
       </div>
       ${!uploadInProgressOrComplete
         ? html`<button class="UppyDashboardItem-edit"
+                       type="button"
                        aria-label="Edit file"
                        title="Edit file"
                        onclick=${(e) => props.showFileCard(file.id)}>
@@ -105,6 +107,7 @@ module.exports = function fileItem (props) {
       }
       ${file.uploadURL
         ? html`<button class="UppyDashboardItem-copyLink"
+                       type="button"
                        aria-label="Copy link"
                        title="Copy link"
                        onclick=${() => {
@@ -121,6 +124,7 @@ module.exports = function fileItem (props) {
     <div class="UppyDashboardItem-action">
       ${!isUploaded
         ? html`<button class="UppyDashboardItem-remove"
+                       type="button"
                        aria-label="Remove file"
                        title="Remove file"
                        onclick=${() => props.removeFile(file.id)}>