Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add geosearch distraction free check, prevent input focus on exiting distraction free, update e2e

Ed Platob918ede81641
diff --git a/e2e/features/ui/distraction-free-mode-test.js b/e2e/features/ui/distraction-free-mode-test.js
index 599661093..af696c595 100644
--- a/e2e/features/ui/distraction-free-mode-test.js
+++ b/e2e/features/ui/distraction-free-mode-test.js
@@ -1,50 +1,61 @@
const reuseables = require('../../reuseables/skip-tour.js');
const localSelectors = require('../../reuseables/selectors.js');
+const {
+ geosearchMinimizeButton,
+ geosearchToolbarButton,
+ sidebarContainer,
+ measureBtn,
+} = localSelectors;
+
const TIME_LIMIT = 5000;
module.exports = {
- before: (client) => {
- reuseables.loadAndSkipTour(client, TIME_LIMIT);
+ before: (c) => {
+ reuseables.loadAndSkipTour(c, TIME_LIMIT);
+ // ensure geosearch is minimized
+ c.click(geosearchMinimizeButton);
},
// verify distraction free mode shortcut hides ui elements
- 'Enabling distraction free mode with shortcut key hides UI elements': (client) => {
- client.pause(300);
- client.sendKeys('body', [client.Keys.SHIFT, 'd', client.Keys.NULL]);
- client.pause(300);
-
- client.waitForElementNotVisible('.timeline-container', TIME_LIMIT);
- client.waitForElementNotVisible(localSelectors.sidebarContainer, TIME_LIMIT);
- client.waitForElementNotPresent('#wv-link-button', TIME_LIMIT);
- client.waitForElementNotPresent('#wv-proj-button', TIME_LIMIT);
- client.waitForElementNotPresent('#wv-image-button', TIME_LIMIT);
- client.waitForElementNotVisible(localSelectors.measureBtn, TIME_LIMIT);
- client.waitForElementNotVisible('.wv-map-zoom-in', TIME_LIMIT);
- client.waitForElementNotVisible('.wv-map-zoom-out', TIME_LIMIT);
- client.waitForElementNotVisible('.wv-map-scale-metric', TIME_LIMIT);
- client.waitForElementNotVisible('.wv-map-scale-imperial', TIME_LIMIT);
+ 'Enabling distraction free mode with shortcut key hides UI elements': (c) => {
+ c.pause(300);
+ c.sendKeys('body', [c.Keys.SHIFT, 'd', c.Keys.NULL]);
+ c.pause(300);
+
+ c.waitForElementNotVisible('.timeline-container', TIME_LIMIT);
+ c.waitForElementNotVisible(sidebarContainer, TIME_LIMIT);
+ c.waitForElementNotVisible(geosearchToolbarButton, TIME_LIMIT);
+ c.waitForElementNotPresent('#wv-link-button', TIME_LIMIT);
+ c.waitForElementNotPresent('#wv-proj-button', TIME_LIMIT);
+ c.waitForElementNotPresent('#wv-image-button', TIME_LIMIT);
+ c.waitForElementNotVisible(measureBtn, TIME_LIMIT);
+ c.waitForElementNotVisible('.wv-map-zoom-in', TIME_LIMIT);
+ c.waitForElementNotVisible('.wv-map-zoom-out', TIME_LIMIT);
+ c.waitForElementNotVisible('.wv-map-scale-metric', TIME_LIMIT);
+ c.waitForElementNotVisible('.wv-map-scale-imperial', TIME_LIMIT);
},
// verify turning off distraction free mode shortcut returns hidden ui elements
- 'Disabling distraction free mode with shortcut key returns UI elements': (client) => {
- client.pause(300);
- client.sendKeys('body', [client.Keys.SHIFT, 'd', client.Keys.NULL]);
- client.pause(300);
-
- client.waitForElementVisible('.timeline-container', TIME_LIMIT);
- client.waitForElementVisible(localSelectors.sidebarContainer, TIME_LIMIT);
- client.waitForElementVisible('#wv-link-button', TIME_LIMIT);
- client.waitForElementPresent('#wv-proj-button', TIME_LIMIT);
- client.waitForElementPresent('#wv-image-button', TIME_LIMIT);
- client.waitForElementVisible(localSelectors.measureBtn, TIME_LIMIT);
- client.waitForElementPresent('.wv-map-zoom-in', TIME_LIMIT);
- client.waitForElementPresent('.wv-map-zoom-out', TIME_LIMIT);
- client.waitForElementPresent('.wv-map-scale-metric', TIME_LIMIT);
- client.waitForElementPresent('.wv-map-scale-imperial', TIME_LIMIT);
+ 'Disabling distraction free mode with shortcut key returns UI elements': (c) => {
+ c.pause(300);
+ c.sendKeys('body', [c.Keys.SHIFT, 'd', c.Keys.NULL]);
+ c.pause(300);
+
+ c.waitForElementVisible('.timeline-container', TIME_LIMIT);
+ c.waitForElementVisible(sidebarContainer, TIME_LIMIT);
+ c.waitForElementVisible(geosearchToolbarButton, TIME_LIMIT);
+ c.waitForElementVisible('#wv-link-button', TIME_LIMIT);
+ c.waitForElementPresent('#wv-proj-button', TIME_LIMIT);
+ c.waitForElementPresent('#wv-image-button', TIME_LIMIT);
+ c.waitForElementVisible(measureBtn, TIME_LIMIT);
+ c.waitForElementPresent('.wv-map-zoom-in', TIME_LIMIT);
+ c.waitForElementPresent('.wv-map-zoom-out', TIME_LIMIT);
+ c.waitForElementPresent('.wv-map-scale-metric', TIME_LIMIT);
+ c.waitForElementPresent('.wv-map-scale-imperial', TIME_LIMIT);
},
- after: (client) => {
- client.end();
+ after: (c) => {
+ c.end();
},
};
diff --git a/web/js/components/geosearch/geosearch-modal.js b/web/js/components/geosearch/geosearch-modal.js
index a5f53f978..0ae623c36 100644
--- a/web/js/components/geosearch/geosearch-modal.js
+++ b/web/js/components/geosearch/geosearch-modal.js
@@ -408,9 +408,11 @@ const mapStateToProps = (state) => {
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;
+ const distractionFreeModeToggledOff = lastAction.type === 'UI/TOGGLE_DISTRACTION_FREE_MODE';
+ const preventInputFocus = measureToggledOff || distractionFreeModeToggledOff;
return {
- preventInputFocus: measureToggledOff,
+ preventInputFocus,
coordinates,
geosearchMobileModalOpen,
isCoordinatePairWithinExtent: (targetCoordinates) => areCoordinatesWithinExtent(map, config, targetCoordinates),
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index af2fb96a4..4f314bc2c 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -214,6 +214,7 @@ class toolbarContainer extends Component {
const {
config,
faSize,
+ isDistractionFreeModeActive,
isGeosearchExpanded,
isMobile,
openModal,
@@ -240,7 +241,7 @@ class toolbarContainer extends Component {
return (
<Button
style={{
- display: buttonDisplayConditions ? 'inline-block' : 'none',
+ display: !isDistractionFreeModeActive && buttonDisplayConditions ? 'inline-block' : 'none',
}}
id={buttonId}
className="wv-toolbar-button"