Skip to content

Commit

Permalink
Improve the way the URL bar responds to clicks and keypresses
Browse files Browse the repository at this point in the history
  • Loading branch information
CGamesPlay committed Jan 14, 2019
1 parent 9ba96c2 commit 484c218
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/renderer/UrlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,18 @@ export default class UrlBar extends React.PureComponent<Props, State> {
if (inputEl) {
inputEl.value = displayedUrl(this.props.url);
}
} else {
this.setState({ isEditing: true });
}
};

handleClick = (event: Event) => {
handleChange = (e: Event) => {
this.setState({ isEditing: true });
};

handleFocus = (event: Event) => {
const inputEl = this.urlInput;
if (!inputEl) return;
event.preventDefault();
inputEl.select();
setTimeout(() => inputEl.select(), 10);
};

handleBlur = (event: Event) => {
Expand All @@ -106,7 +108,8 @@ export default class UrlBar extends React.PureComponent<Props, State> {
"is-primary": this.state.isEditing,
})}
onKeyDown={this.handleKeyPress}
onClick={this.handleClick}
onChange={this.handleChange}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
/>
</form>
Expand Down

0 comments on commit 484c218

Please sign in to comment.