Skip to content

Commit

Permalink
Add type="button" to all generated buttons!
Browse files Browse the repository at this point in the history
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 9c1e6fc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ var _ = Mavo.Collection = $.Class({

if (!button) {
button = $.create("button", {
type: "button",
className: "mv-add",
textContent: this.mavo._("add-item", this)
});
Expand Down
1 change: 1 addition & 0 deletions src/mavo.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ var _ = self.Mavo = $.Class({
this._("item-deleted", {name: phrase}),
{
tag: "button",
type: "button",
textContent: this._("undo"),
events: {
click: evt => {
Expand Down
1 change: 1 addition & 0 deletions src/ui.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
Expand Down
3 changes: 3 additions & 0 deletions src/ui.itembar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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"
});
Expand Down
1 change: 1 addition & 0 deletions src/ui.message.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var _ = Mavo.UI.Message = $.Class({

if (o.dismiss.button) {
$.create("button", {
type: "button",
className: "mv-close mv-ui",
textContent: "×",
events: {
Expand Down

0 comments on commit 9c1e6fc

Please sign in to comment.