Skip to content

Commit

Permalink
fix: put onClose onvocation before closing the dropdown for PopupBase…
Browse files Browse the repository at this point in the history
… component

Closes #ONEUI-164
  • Loading branch information
antipin committed Feb 17, 2020
1 parent a6123d7 commit 8d248f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/PopupBase/PopupBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export class PopupBase extends React.Component {
const { isOpen } = this.state;

if (isOpen) {
this.setState({ isOpen: false });
if (onClose) {
onClose();
}
this.setState({ isOpen: false });
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/components/SelectedOption/SelectedOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ export const SelectedOption: React.FC<Props> = React.forwardRef((props, ref) =>

return (
<As {...rest} ref={ref} {...block(props)}>
<button {...elem('button', props)} onClick={onDelete} onKeyDown={handleKeyDown}>
<button
{...elem('button', props)}
type="button"
onClick={onDelete}
onKeyDown={handleKeyDown}
>
<IoIosClose {...elem('buttonIcon', props)} />
</button>
{renderChildren()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exports[`<SelectedOption> should render default props correctly with string as c
className="SelectedOption__button"
onClick={[MockFunction]}
onKeyDown={[Function]}
type="button"
>
<IoIosClose
className="SelectedOption__buttonIcon"
Expand Down Expand Up @@ -68,6 +69,7 @@ exports[`<SelectedOption> should render default props correctly with string as c
className="SelectedOption__button"
onClick={[MockFunction]}
onKeyDown={[Function]}
type="button"
>
<IoIosClose
className="SelectedOption__buttonIcon"
Expand Down

0 comments on commit 8d248f1

Please sign in to comment.