Преглед изворни кода

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.
Sergiu Miclea пре 8 година
родитељ
комит
8bf53d082e
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src/components/organisms/AlertModal/index.jsx

+ 1 - 1
src/components/organisms/AlertModal/index.jsx

@@ -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()