Просмотр исходного кода

Fix an issue where sometimes the add cloud connection modal wouldn't close on ESC key CORWEB-74

The AddCloudConnection popup doesn't get focused when openning from the Wizard, probably because multiple popups are prepared for each cloud provider.
Sergiu Miclea 8 лет назад
Родитель
Сommit
f9cfdeb5fd
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      src/components/AddCloudConnection/AddCloudConnection.js

+ 5 - 1
src/components/AddCloudConnection/AddCloudConnection.js

@@ -97,6 +97,10 @@ class AddCloudConnection extends Reflux.Component {
     } else if (this.props.cloud) {
     } else if (this.props.cloud) {
       this.chooseCloud(this.props.cloud)
       this.chooseCloud(this.props.cloud)
     }
     }
+
+    // Fixes an issue with focus when multiple modals are rendered and escape key is not captured.
+    // Test with adding cloud connection from wizard.
+    setTimeout(() => { this.rootDiv.focus() }, 100)
   }
   }
 
 
   /**
   /**
@@ -572,7 +576,7 @@ class AddCloudConnection extends Reflux.Component {
       modalBody = this.renderCloudFields(this.state.currentCloud)
       modalBody = this.renderCloudFields(this.state.currentCloud)
     }
     }
     return (
     return (
-      <div className={s.root}>
+      <div tabIndex="0" className={s.root} ref={rootDiv => { this.rootDiv = rootDiv }}>
         <div className={s.header}>
         <div className={s.header}>
           <h3>{title}</h3>
           <h3>{title}</h3>
         </div>
         </div>