Skip to content

Commit

Permalink
fix(Dropdown): set default button type to button (patternfly#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcfaul authored and tlabaj committed Jan 9, 2019
1 parent ac9ec75 commit b4bded3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const DropdownItem = ({ className, children, isHovered, component: Component, is
additionalProps.tabIndex = isDisabled ? -1 : additionalProps.tabIndex;
} else if (Component === 'button') {
additionalProps.disabled = isDisabled;
additionalProps.type = additionalProps.type || 'button';
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class DropdownToggle extends Component {
onToggle,
parentRef,
id,
type,
...props
} = this.props;
return (
Expand All @@ -96,6 +97,7 @@ class DropdownToggle extends Component {
isPlain && styles.modifiers.plain,
className
)}
type={type || 'button'}
onClick={_event => onToggle && onToggle(!isOpen)}
aria-expanded={isOpen}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ exports[`KebabToggle basic 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down Expand Up @@ -280,6 +281,7 @@ exports[`KebabToggle dropup + right aligned 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down Expand Up @@ -454,6 +456,7 @@ exports[`KebabToggle dropup 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down Expand Up @@ -656,6 +659,7 @@ exports[`KebabToggle expanded 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down Expand Up @@ -742,6 +746,7 @@ exports[`KebabToggle expanded 1`] = `
className=""
disabled={false}
href="#"
type="button"
>
Action
</button>
Expand Down Expand Up @@ -779,6 +784,7 @@ exports[`KebabToggle expanded 1`] = `
className="pf-m-disabled"
disabled={true}
href="#"
type="button"
>
Disabled Action
</button>
Expand Down Expand Up @@ -840,6 +846,7 @@ exports[`KebabToggle expanded 1`] = `
className=""
disabled={false}
href="#"
type="button"
>
Separated Action
</button>
Expand Down Expand Up @@ -994,6 +1001,7 @@ exports[`KebabToggle plain 1`] = `
className="pf-c-dropdown__toggle pf-m-plain"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down Expand Up @@ -1168,6 +1176,7 @@ exports[`KebabToggle regular 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down Expand Up @@ -1342,6 +1351,7 @@ exports[`KebabToggle right aligned 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down Expand Up @@ -1470,6 +1480,7 @@ exports[`dropdown basic 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -1670,6 +1681,7 @@ exports[`dropdown dropup + right aligned 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -1853,6 +1865,7 @@ exports[`dropdown dropup 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -2064,6 +2077,7 @@ exports[`dropdown expanded 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -2153,6 +2167,7 @@ exports[`dropdown expanded 1`] = `
className=""
disabled={false}
href="#"
type="button"
>
Action
</button>
Expand Down Expand Up @@ -2190,6 +2205,7 @@ exports[`dropdown expanded 1`] = `
className="pf-m-disabled"
disabled={true}
href="#"
type="button"
>
Disabled Action
</button>
Expand Down Expand Up @@ -2251,6 +2267,7 @@ exports[`dropdown expanded 1`] = `
className=""
disabled={false}
href="#"
type="button"
>
Separated Action
</button>
Expand Down Expand Up @@ -2411,6 +2428,7 @@ exports[`dropdown regular 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -2594,6 +2612,7 @@ exports[`dropdown right aligned 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exports[`dropdown items button 1`] = `
className=""
disabled={false}
href="#"
type="button"
>
Something
</button>
Expand Down Expand Up @@ -51,6 +52,7 @@ exports[`dropdown items disabled button 1`] = `
className="pf-m-disabled"
disabled={true}
href="#"
type="button"
>
Something
</button>
Expand Down Expand Up @@ -83,6 +85,7 @@ exports[`dropdown items hover button 1`] = `
className="pf-m-hover"
disabled={false}
href="#"
type="button"
>
Something
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ exports[`state active 1`] = `
className="pf-c-dropdown__toggle pf-m-active"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -132,6 +133,7 @@ exports[`state focus 1`] = `
className="pf-c-dropdown__toggle pf-m-focus"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -215,6 +217,7 @@ exports[`state hover 1`] = `
className="pf-c-dropdown__toggle pf-m-hover"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ exports[`Dropdown toggle 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
Dropdown
<CaretDownIcon
Expand Down Expand Up @@ -128,6 +129,7 @@ exports[`Kebab toggle 1`] = `
className="pf-c-dropdown__toggle"
id="Dropdown Toggle"
onClick={[Function]}
type="button"
>
<EllipsisVIcon
color="currentColor"
Expand Down

0 comments on commit b4bded3

Please sign in to comment.