Explorar el Código

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 hace 8 años
padre
commit
8bf53d082e
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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
   id: string
 
 
   componentDidMount() {
   componentDidMount() {
-    this.id = new Date().getTime().toString()
+    this.id = `${new Date().getTime().toString()}-${Math.random()}`
     KeyboardManager.onEnter(`alert-${this.id}`, () => {
     KeyboardManager.onEnter(`alert-${this.id}`, () => {
       if (this.props.isOpen) {
       if (this.props.isOpen) {
         this.props.onConfirmation()
         this.props.onConfirmation()