Skip to content

Commit

Permalink
Fix Enter key ignore in some confirmation modals
Browse files Browse the repository at this point in the history
Sometimes pressing `Enter` would not confirm in a confirmation modal
(ex.: trying to delete replica's disks).
This was caused by the fact that the same id was generated for all
modals in a page, if they were created at exactly the same time.
  • Loading branch information
Sergiu Miclea committed May 2, 2018
1 parent 1dbcc87 commit 8bf53d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/organisms/AlertModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AlertModal extends React.Component<Props> {
id: string

componentDidMount() {
this.id = new Date().getTime().toString()
this.id = `${new Date().getTime().toString()}-${Math.random()}`
KeyboardManager.onEnter(`alert-${this.id}`, () => {
if (this.props.isOpen) {
this.props.onConfirmation()
Expand Down

0 comments on commit 8bf53d0

Please sign in to comment.