<commit_before>const React = require("react");
const SearchMagic = require("components/SearchMagic/SearchMagic");
const {connect} = require("react-redux");
const actions = require("actions/index");
const Platform = require("lib/platform");

const Search = React.createClass({
  getInitialState: function () {
    return {
      focus: false
    };
  },
  setValueAndSuggestions: function (value) {
    this.props.dispatch(actions.updateSearchString(value));
    this.props.dispatch(actions.getSuggestions(this.props.Search.currentEngine.name, value));
  },
  setValueAndClose: function (value) {
    this.props.dispatch(actions.updateSearchString(value));
    this.refs.input.blur();
  },
  performSearch: function (options) {
    Platform.search.performSearch({
      engineName: options.engineName,
      searchString: options.searchString,
      healthReportKey: "1",
      searchPurpose: "d"
    });
  },
  render: function () {
    const {currentEngine, searchString} = this.props.Search;
    return (<form className="search">
      <div className="search-input-wrapper">
        <div className="search-icon" />
        <input ref="input" className="search-input" type="search"
          value={searchString}
          onChange={e => this.setValueAndSuggestions(e.target.value)}
          onFocus={() => this.setState({focus: true})}
          onBlur={() => setTimeout(() => this.setState({focus: false}), 200)} />
        <button onClick={e => {
          e.preventDefault();
          this.performSearch({engineName: currentEngine.name, searchString});
        }} className="search-submit"></button>
        <SearchMagic
          show={searchString && this.state.focus}
          performSearch={this.performSearch}
          manageEngines={() => Platform.search.manageEngines()}
          {...this.props.Search} />
      </div>
    </form>);
  }
});

function select(state) {
  return {
    Search: state.Search
  };
}

module.exports = connect(select)(Search);<commit_msg>[#171] add screen reader for search button<commit_after>const React = require("react");
const SearchMagic = require("components/SearchMagic/SearchMagic");
const {connect} = require("react-redux");
const actions = require("actions/index");
const Platform = require("lib/platform");

const Search = React.createClass({
  getInitialState: function () {
    return {
      focus: false
    };
  },
  setValueAndSuggestions: function (value) {
    this.props.dispatch(actions.updateSearchString(value));
    this.props.dispatch(actions.getSuggestions(this.props.Search.currentEngine.name, value));
  },
  setValueAndClose: function (value) {
    this.props.dispatch(actions.updateSearchString(value));
    this.refs.input.blur();
  },
  performSearch: function (options) {
    Platform.search.performSearch({
      engineName: options.engineName,
      searchString: options.searchString,
      healthReportKey: "1",
      searchPurpose: "d"
    });
  },
  render: function () {
    const {currentEngine, searchString} = this.props.Search;
    return (<form className="search">
      <div className="search-input-wrapper">
        <div className="search-icon" />
        <input ref="input" className="search-input" type="search"
          value={searchString}
          onChange={e => this.setValueAndSuggestions(e.target.value)}
          onFocus={() => this.setState({focus: true})}
          onBlur={() => setTimeout(() => this.setState({focus: false}), 200)} />
        <button onClick={e => {
          e.preventDefault();
          this.performSearch({engineName: currentEngine.name, searchString});
        }} className="search-submit">
         <span className="sr-only" >Search</span>
        </button>
        <SearchMagic
          show={searchString && this.state.focus}
          performSearch={this.performSearch}
          manageEngines={() => Platform.search.manageEngines()}
          {...this.props.Search} />
      </div>
    </form>);
  }
});

function select(state) {
  return {
    Search: state.Search
  };
}

module.exports = connect(select)(Search);
{'fraction_non_alphanumeric': 0.15407407407407409, 'fraction_numerical': 0.0027160493827160493, 'mean_word_length': 3.3372591006423984, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '795664', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1136, 'n_words': 203}