@@ -48,7 +48,7 @@ class UrlBar extends ImmutableComponent {
48
48
return windowStore . getFrame ( this . props . activeFrameKey )
49
49
}
50
50
51
- isActive ( ) {
51
+ get isActive ( ) {
52
52
return this . props . urlbar . get ( 'active' )
53
53
}
54
54
@@ -285,13 +285,18 @@ class UrlBar extends ImmutableComponent {
285
285
}
286
286
287
287
componentDidUpdate ( prevProps ) {
288
- this . updateDOM ( )
289
288
// Select the part of the URL which was an autocomplete suffix.
290
- if ( this . urlInput && this . props . locationValueSuffix . length > 0 ) {
291
- const len = this . urlInput . value . length
289
+ if ( this . urlInput && this . props . locationValueSuffix . length > 0 &&
290
+ this . props . urlbar . get ( 'location' ) !== prevProps . urlbar . get ( 'location' ) ) {
292
291
const suffixLen = this . props . locationValueSuffix . length
292
+ this . urlInput . value = this . locationValue + this . props . locationValueSuffix
293
+ const len = this . urlInput . value . length
293
294
this . urlInput . setSelectionRange ( len - suffixLen , len )
294
295
}
296
+ if ( this . isSelected ( ) !== prevProps . urlbar . get ( 'selected' ) ||
297
+ this . isFocused ( ) !== prevProps . urlbar . get ( 'focused' ) ) {
298
+ this . updateDOM ( )
299
+ }
295
300
}
296
301
297
302
get hostValue ( ) {
@@ -370,6 +375,9 @@ class UrlBar extends ImmutableComponent {
370
375
}
371
376
372
377
render ( ) {
378
+ const value = ! this . isActive
379
+ ? this . locationValue + this . props . locationValueSuffix
380
+ : undefined
373
381
return < form
374
382
className = 'urlbarForm'
375
383
action = '#'
@@ -412,10 +420,10 @@ class UrlBar extends ImmutableComponent {
412
420
onFocus = { this . onFocus }
413
421
onBlur = { this . onBlur }
414
422
onKeyDown = { this . onKeyDown }
415
- onChange = { this . onChange }
423
+ onKeyUp = { this . onChange }
416
424
onClick = { this . onClick }
417
425
onContextMenu = { this . onContextMenu }
418
- value = { this . locationValue + this . props . locationValueSuffix }
426
+ value = { value }
419
427
data-l10n-id = 'urlbar'
420
428
className = { cx ( {
421
429
insecure : ! this . props . isSecure && this . props . loading === false && ! this . isHTTPPage ,
0 commit comments