diff --git a/Source/Widgets/Geocoder/Geocoder.js b/Source/Widgets/Geocoder/Geocoder.js index d697bbb01aa3..62caa68a9a5d 100644 --- a/Source/Widgets/Geocoder/Geocoder.js +++ b/Source/Widgets/Geocoder/Geocoder.js @@ -70,7 +70,18 @@ value: searchText,\ valueUpdate: "afterkeydown",\ disable: isSearchInProgress,\ css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 }'); + + this._onTextBoxFocus = function() { + // as of 2016-10-19, setTimeout is required to ensure that the + // text is focused on Safari 10 + setTimeout(function() { + textBox.select(); + }, 0); + }; + + textBox.addEventListener('focus', this._onTextBoxFocus, false); form.appendChild(textBox); + this._textBox = textBox; var searchButton = document.createElement('span'); searchButton.className = 'cesium-geocoder-searchButton'; @@ -164,6 +175,7 @@ cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, knockout.cleanNode(this._form); this._container.removeChild(this._form); + this._textBox.removeEventListener('focus', this._onTextBoxFocus, false); return destroyObject(this); };