diff --git a/data/core.yaml b/data/core.yaml index 466374afc..354c40771 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -538,6 +538,7 @@ en: key: L title: Show My Location locating: "Locating, please wait..." + location_unavailable: Your location is unavailable inspector: zoom_to: key: Z diff --git a/dist/locales/en.json b/dist/locales/en.json index debd7deaf..0e8c33ee3 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -680,7 +680,8 @@ "geolocate": { "key": "L", "title": "Show My Location", - "locating": "Locating, please wait..." + "locating": "Locating, please wait...", + "cannot_locate": "Your location is unavailable" }, "inspector": { "zoom_to": { diff --git a/modules/ui/geolocate.js b/modules/ui/geolocate.js index 2b6ed59aa..53f063550 100644 --- a/modules/ui/geolocate.js +++ b/modules/ui/geolocate.js @@ -5,6 +5,7 @@ import { tooltip } from '../util/tooltip'; import { geoExtent } from '../geo'; import { modeBrowse } from '../modes/browse'; import { svgIcon } from '../svg/icon'; +import { uiFlash } from './flash'; import { uiLoading } from './loading'; import { uiTooltipHtml } from './tooltipHtml'; @@ -33,7 +34,7 @@ export function uiGeolocate(context) { } // This timeout ensures that we still call finish() even if // the user declines to share their location in Firefox - _timeoutID = setTimeout(finish, 10000 /* 10sec */ ); + _timeoutID = setTimeout(error, 10000 /* 10sec */ ); } function zoomTo() { @@ -52,6 +53,9 @@ export function uiGeolocate(context) { } function error() { + uiFlash() + .text(t('geolocate.location_unavailable')) + .iconName('#iD-icon-geolocate')(); finish(); } @@ -66,7 +70,7 @@ export function uiGeolocate(context) { } return function(selection) { - if (!navigator.geolocation) return; + if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return; _button = selection .append('button')