Interactive interface for browsing global, full-resolution satellite imagery
prevent input focus when exited out of measure mode
Ed Platob2d6ec17cb2d
diff --git a/web/js/components/geosearch/geosearch-input.js b/web/js/components/geosearch/geosearch-input.jsindex 64478b719..0290f3cd2 100644--- a/web/js/components/geosearch/geosearch-input.js+++ b/web/js/components/geosearch/geosearch-input.js@@ -13,9 +13,13 @@ class SearchBox extends Component {}componentDidMount() {- const { geosearchMobileModalOpen, isExpanded, suggestions } = this.props;+ const {+ geosearchMobileModalOpen,+ preventInputFocus,+ suggestions,+ } = this.props;// timeout necessary to trigger input focus- if (isExpanded || geosearchMobileModalOpen) {+ if (!preventInputFocus || geosearchMobileModalOpen) {setTimeout(() => {if (this.geosearchInput) {this.geosearchInput.focus();@@ -257,8 +261,8 @@ SearchBox.propTypes = {coordinatesPending: PropTypes.array,geosearchMobileModalOpen: PropTypes.bool,inputValue: PropTypes.string,- isExpanded: PropTypes.bool,isMobile: PropTypes.bool,+ preventInputFocus: PropTypes.bool,onChange: PropTypes.func,onCoordinateInputSelect: PropTypes.func,onSelect: PropTypes.func,diff --git a/web/js/components/geosearch/geosearch-modal.js b/web/js/components/geosearch/geosearch-modal.jsindex 05500960b..a5f53f978 100644--- a/web/js/components/geosearch/geosearch-modal.js+++ b/web/js/components/geosearch/geosearch-modal.js@@ -346,11 +346,11 @@ class GeosearchModal extends Component {render() {const {- geosearchMobileModalOpen,- isExpanded,- isMobile,coordinatesPending,+ geosearchMobileModalOpen,inputValue,+ isMobile,+ preventInputFocus,suggestions,} = this.props;const {@@ -372,8 +372,8 @@ class GeosearchModal extends Component {coordinatesPending={coordinatesPending}geosearchMobileModalOpen={geosearchMobileModalOpen}inputValue={inputValue}- isExpanded={isExpanded}isMobile={isMobile}+ preventInputFocus={preventInputFocus}onChange={this.onChange}onCoordinateInputSelect={this.onCoordinateInputSelect}onSelect={this.onSelect}@@ -393,23 +393,28 @@ const mapStateToProps = (state) => {const {browser,config,+ lastAction,map,modal,geosearch,} = state;const {- coordinates, isCoordinateSearchActive, isExpanded, suggestions, suggestedPlace,+ coordinates,+ isCoordinateSearchActive,+ suggestions,+ suggestedPlace,} = geosearch;const isMobile = browser.lessThan.medium;const geosearchMobileModalOpen = modal.isOpen && modal.id === 'TOOLBAR_GEOSEARCH_MOBILE';// Collapse when image download, GIF, measure tool, or distraction free mode is active+ const measureToggledOff = lastAction.type === 'MEASURE/TOGGLE_MEASURE_ACTIVE' && lastAction.value === false;return {+ preventInputFocus: measureToggledOff,coordinates,geosearchMobileModalOpen,isCoordinatePairWithinExtent: (targetCoordinates) => areCoordinatesWithinExtent(map, config, targetCoordinates),isCoordinateSearchActive,- isExpanded,isMobile,processMagicKey: (magicKey) => processMagicKey(magicKey, config),reverseGeocode: (coords) => reverseGeocode(coords, config),@@ -448,8 +453,8 @@ GeosearchModal.propTypes = {inputValue: PropTypes.string,isCoordinatePairWithinExtent: PropTypes.func,isCoordinateSearchActive: PropTypes.bool,- isExpanded: PropTypes.bool,isMobile: PropTypes.bool,+ preventInputFocus: PropTypes.bool,processMagicKey: PropTypes.func,reverseGeocode: PropTypes.func,setPlaceMarker: PropTypes.func,diff --git a/web/js/components/geosearch/geosearch.js b/web/js/components/geosearch/geosearch.jsindex 7ac4790b9..03a8fae8d 100644--- a/web/js/components/geosearch/geosearch.js+++ b/web/js/components/geosearch/geosearch.js@@ -76,7 +76,6 @@ const mapStateToProps = (state) => {} = state;const { features: { geocodeSearch: { url: requestUrl } } } = config;const isFeatureEnabled = !!requestUrl;- const { isActive } = measure;const { gifActive } = animation;const {isExpanded,@@ -85,7 +84,7 @@ const mapStateToProps = (state) => {const isMobile = browser.lessThan.medium;const snapshotModalOpen = modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT';// Collapse when image download, GIF, measure tool, or distraction free mode is active- const shouldCollapseFromOtherUI = snapshotModalOpen || isActive || gifActive || isDistractionFreeModeActive;+ const shouldCollapseFromOtherUI = snapshotModalOpen || measure.isActive || gifActive || isDistractionFreeModeActive;return {isExpanded,