Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Updated type attribute for dropdown button
Browse files Browse the repository at this point in the history
no refs

The dropdown button component was missing `type="button"` when used as a button, which caused it to act like a `submit` button when used as part of a form, like in Member details page. This change adds type attribute to the button to fix the issue.
  • Loading branch information
rishabhgrg committed May 4, 2021
1 parent e79f7f2 commit 0c6dbed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/components/gh-dropdown-button.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import Component from '@ember/component';
import DropdownMixin from 'ghost-admin/mixins/dropdown-mixin';
import {computed} from '@ember/object';
import {inject as service} from '@ember/service';

export default Component.extend(DropdownMixin, {
dropdown: service(),

tagName: 'button',
attributeBindings: ['href', 'role'],
attributeBindings: ['href', 'role', 'type'],
role: 'button',

// matches with the dropdown this button toggles
dropdownName: null,

type: computed(function () {
return this.tagName === 'button' ? 'button' : null;
}),

// Notify dropdown service this dropdown should be toggled
click(event) {
this._super(event);
Expand Down

0 comments on commit 0c6dbed

Please sign in to comment.