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

add autoFocus attr to SearchTypeAhead

yusuketk 5 лет назад
Родитель
Сommit
3c9a0b96f0
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/client/js/components/SearchTypeahead.jsx

+ 3 - 3
src/client/js/components/SearchTypeahead.jsx

@@ -44,9 +44,6 @@ class SearchTypeahead extends React.Component {
   }
 
   componentDidMount() {
-    // **MEMO** This doesn't work at this time -- 2019.05.13 Yuki Takei
-    // It is needed to use Modal component of react-bootstrap when showing Move/Duplicate/CreateNewPage modals
-    // this.typeahead.getInstance().focus();
   }
 
   componentWillUnmount() {
@@ -222,6 +219,7 @@ class SearchTypeahead extends React.Component {
           renderMenuItemChildren={this.renderMenuItemChildren}
           caseSensitive={false}
           defaultSelected={defaultSelected}
+          autoFocus={this.props.autoFocus}
         />
         {resetFormButton}
       </div>
@@ -252,6 +250,7 @@ SearchTypeahead.propTypes = {
   placeholder:     PropTypes.string,
   keywordOnInit:   PropTypes.string,
   helpElement:     PropTypes.object,
+  autoFocus:       PropTypes.bool,
   behaviorOfResetBtn: PropTypes.oneOf(['restore', 'clear']),
 };
 
@@ -265,6 +264,7 @@ SearchTypeahead.defaultProps = {
   placeholder:     '',
   keywordOnInit:   '',
   behaviorOfResetBtn: 'restore',
+  autoFocus:       false,
   onInputChange: () => {},
 };