From fe40cdd7f180cf026c020bbc43c06b3b1238650d Mon Sep 17 00:00:00 2001 From: Micah Tigley Date: Thu, 7 May 2020 15:19:36 +0000 Subject: [PATCH] Bug 1617237 - Part 4: Select all text when URL input is focused r=daisuke Depends on D72227 Differential Revision: https://phabricator.services.mozilla.com/D72274 --- devtools/client/framework/components/DebugTargetInfo.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devtools/client/framework/components/DebugTargetInfo.js b/devtools/client/framework/components/DebugTargetInfo.js index 8921acaffe1f..a1eabe619087 100644 --- a/devtools/client/framework/components/DebugTargetInfo.js +++ b/devtools/client/framework/components/DebugTargetInfo.js @@ -42,6 +42,7 @@ class DebugTargetInfo extends PureComponent { this.state = { urlValue: props.toolbox.target.url }; this.onChange = this.onChange.bind(this); + this.onFocus = this.onFocus.bind(this); this.onSubmit = this.onSubmit.bind(this); } @@ -150,6 +151,10 @@ class DebugTargetInfo extends PureComponent { this.setState({ urlValue: target.value }); } + onFocus({ target }) { + target.select(); + } + onSubmit(event) { event.preventDefault(); let url = this.state.urlValue; @@ -253,6 +258,7 @@ class DebugTargetInfo extends PureComponent { dom.input({ className: "devtools-textinput debug-target-url-input", onChange: this.onChange, + onFocus: this.onFocus, defaultValue: url, }) );