Permalink
Browse files

Add type="button" to all generated buttons!

This caused the weirdest bug ever with an item’s delete button becoming
the de facto submit button of a form. Holyshit.
  • Loading branch information...
LeaVerou committed May 19, 2018
1 parent 91f3dc3 commit 9c1e6fcd31a52bc10f1f08f4d1ebf47eac72ac3b
Showing with 7 additions and 0 deletions.
  1. +1 −0 src/collection.js
  2. +1 −0 src/mavo.js
  3. +1 −0 src/ui.bar.js
  4. +3 −0 src/ui.itembar.js
  5. +1 −0 src/ui.message.js
@@ -585,6 +585,7 @@ var _ = Mavo.Collection = $.Class({
if (!button) {
button = $.create("button", {
type: "button",
className: "mv-add",
textContent: this.mavo._("add-item", this)
});
@@ -646,6 +646,7 @@ var _ = self.Mavo = $.Class({
this._("item-deleted", {name: phrase}),
{
tag: "button",
type: "button",
textContent: this._("undo"),
events: {
click: evt => {
@@ -64,6 +64,7 @@ var _ = Mavo.UI.Bar = $.Class({
}
else if (!this[id]) {
this[id] = $.create("button", {
type: "button",
className: `mv-${id}`,
textContent: this.mavo._(id)
});
@@ -23,10 +23,12 @@ var _ = Mavo.UI.Itembar = $.Class({
var buttons = [
{
tag: "button",
type: "button",
title: this.mavo._("delete-item", this.item),
className: "mv-delete"
}, {
tag: "button",
type: "button",
title: this.mavo._(`add-item-${this.collection.bottomUp? "after" : "before"}`, this.item),
className: "mv-add"
}
@@ -35,6 +37,7 @@ var _ = Mavo.UI.Itembar = $.Class({
if (this.item instanceof Mavo.Group) {
this.dragHandle = $.create({
tag: "button",
type: "button",
title: this.mavo._("drag-to-reorder", this.item),
className: "mv-drag-handle"
});
@@ -40,6 +40,7 @@ var _ = Mavo.UI.Message = $.Class({
if (o.dismiss.button) {
$.create("button", {
type: "button",
className: "mv-close mv-ui",
textContent: "×",
events: {

0 comments on commit 9c1e6fc

Please sign in to comment.