Skip to content

Commit

Permalink
Set type="button" on accordion buttons (#1468)
Browse files Browse the repository at this point in the history
The <button> in <EuiAccordion> doesn’t set a type, so it triggers the
submit action in forms.
  • Loading branch information
pugnascotia authored Jan 23, 2019
1 parent b349c96 commit d077bd9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Re-added EuiI18n, EuiI18nNumber, and EuiContext for localization ([#1466](https://github.com/elastic/eui/pull/1466))
- Set `type="button"` on accordion buttons ([#1468](https://github.com/elastic/eui/pull/1468))

## [`6.6.0`](https://github.com/elastic/eui/tree/v6.6.0)

Expand Down
7 changes: 7 additions & 0 deletions src/components/accordion/__snapshots__/accordion.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ exports[`EuiAccordion behavior closes when clicked twice 1`] = `
aria-expanded={false}
className="euiAccordion__button"
onClick={[Function]}
type="button"
>
<EuiFlexGroup
alignItems="center"
Expand Down Expand Up @@ -167,6 +168,7 @@ exports[`EuiAccordion behavior opens when clicked once 1`] = `
aria-expanded={true}
className="euiAccordion__button"
onClick={[Function]}
type="button"
>
<EuiFlexGroup
alignItems="center"
Expand Down Expand Up @@ -283,6 +285,7 @@ exports[`EuiAccordion is rendered 1`] = `
aria-controls="0"
aria-expanded="false"
class="euiAccordion__button"
type="button"
>
<div
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow"
Expand Down Expand Up @@ -346,6 +349,7 @@ exports[`EuiAccordion props buttonContent is rendered 1`] = `
aria-controls="2"
aria-expanded="false"
class="euiAccordion__button"
type="button"
>
<div
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow"
Expand Down Expand Up @@ -413,6 +417,7 @@ exports[`EuiAccordion props buttonContentClassName is rendered 1`] = `
aria-controls="1"
aria-expanded="false"
class="euiAccordion__button"
type="button"
>
<div
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow"
Expand Down Expand Up @@ -476,6 +481,7 @@ exports[`EuiAccordion props extraAction is rendered 1`] = `
aria-controls="3"
aria-expanded="false"
class="euiAccordion__button"
type="button"
>
<div
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow"
Expand Down Expand Up @@ -546,6 +552,7 @@ exports[`EuiAccordion props initialIsOpen is rendered 1`] = `
aria-controls="4"
aria-expanded="true"
class="euiAccordion__button"
type="button"
>
<div
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow"
Expand Down
1 change: 1 addition & 0 deletions src/components/accordion/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class EuiAccordion extends Component {
aria-expanded={!!this.state.isOpen}
onClick={this.onToggle}
className={buttonClasses}
type="button"
>
<EuiFlexGroup gutterSize="s" alignItems="center" responsive={false}>
<EuiFlexItem grow={false} className="euiAccordion__iconWrapper">
Expand Down

0 comments on commit d077bd9

Please sign in to comment.