···7979 for (const el of this.textareaMarkdownToolbar.querySelectorAll('.markdown-toolbar-button')) {
8080 // upstream bug: The role code is never executed in base MarkdownButtonElement https://github.com/github/markdown-toolbar-element/issues/70
8181 el.setAttribute('role', 'button');
8282+ // the editor usually is in a form, so the buttons should have "type=button", avoiding conflicting with the form's submit.
8383+ if (el.nodeName === 'BUTTON' && !el.getAttribute('type')) el.setAttribute('type', 'button');
8284 }
83858486 const monospaceButton = this.container.querySelector('.markdown-switch-monospace');