Skip to content

Commit 460357c

Browse files
author
Hannah
authored
Merge pull request #4464 from twpayne/geocoder-highlight-on-click
Select Geocoder text on focus. Fixes #4268.
2 parents 37f9e7d + f91b8a7 commit 460357c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Source/Widgets/Geocoder/Geocoder.js

+12
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,18 @@ value: searchText,\
7070
valueUpdate: "afterkeydown",\
7171
disable: isSearchInProgress,\
7272
css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 }');
73+
74+
this._onTextBoxFocus = function() {
75+
// as of 2016-10-19, setTimeout is required to ensure that the
76+
// text is focused on Safari 10
77+
setTimeout(function() {
78+
textBox.select();
79+
}, 0);
80+
};
81+
82+
textBox.addEventListener('focus', this._onTextBoxFocus, false);
7383
form.appendChild(textBox);
84+
this._textBox = textBox;
7485

7586
var searchButton = document.createElement('span');
7687
searchButton.className = 'cesium-geocoder-searchButton';
@@ -164,6 +175,7 @@ cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath,
164175

165176
knockout.cleanNode(this._form);
166177
this._container.removeChild(this._form);
178+
this._textBox.removeEventListener('focus', this._onTextBoxFocus, false);
167179

168180
return destroyObject(this);
169181
};

0 commit comments

Comments
 (0)