Skip to content

Commit

Permalink
Added auto focus on search page
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Feb 5, 2021
1 parent a62196e commit 10dc2e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/elements/netspeak-search-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { delay } from "../lib/util";
interface Props {
query: string;
onQueryEnter: (query: string) => void;

autoFocus?: boolean;
}
interface State {
original: string;
Expand Down Expand Up @@ -70,6 +72,7 @@ export class NetspeakSearchBar extends React.PureComponent<Props, State> {
type="text"
className="NetspeakSearchBar"
value={this.state.value}
autoFocus={this.props.autoFocus}
onChange={this._onChangeHandler}
onKeyUp={this._oKeyupHandler}
/>
Expand Down
3 changes: 3 additions & 0 deletions src/elements/netspeak-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ interface Props extends LocalizableProps {
onSetExampleVisibility?: (value: ExampleVisibility) => void;

pageSize?: number;

autoFocus?: boolean;
}
interface State {
query: string;
Expand Down Expand Up @@ -417,6 +419,7 @@ export class NetspeakSearch extends React.PureComponent<Props, State> {
<NetspeakSearchBar
query={this.state.query}
onQueryEnter={this._onSearchBarQueryEnterHandler}
autoFocus={this.props.autoFocus}
/>
</td>
<td>
Expand Down
1 change: 1 addition & 0 deletions src/page-elements/search-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default class SearchPage extends React.PureComponent<unknown, State> {
defaultExampleVisibility={this.state.exampleVisibility}
onSetExampleVisibility={this._onSetExampleVisibilityHandler}
pageSize={40}
autoFocus={true}
/>
</div>
</Page>
Expand Down

0 comments on commit 10dc2e7

Please sign in to comment.