Skip to content

Commit 8bf53d0

Browse files
author
Sergiu Miclea
committed
Fix Enter key ignore in some confirmation modals
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.
1 parent 1dbcc87 commit 8bf53d0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/components/organisms/AlertModal/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class AlertModal extends React.Component<Props> {
7474
id: string
7575

7676
componentDidMount() {
77-
this.id = new Date().getTime().toString()
77+
this.id = `${new Date().getTime().toString()}-${Math.random()}`
7878
KeyboardManager.onEnter(`alert-${this.id}`, () => {
7979
if (this.props.isOpen) {
8080
this.props.onConfirmation()

0 commit comments

Comments
 (0)