Skip to content

Commit

Permalink
FSR-483: Fix black bar appearing below map on IOS15/Safari. (#271)
Browse files Browse the repository at this point in the history
Co-authored-by: John Shields <[email protected]>
  • Loading branch information
JFSCH and John Shields authored Nov 19, 2021
1 parent 53d57e6 commit 074a882
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/src/js/components/map/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ window.flood.maps.MapContainer = function MapContainer (mapId, options) {
// Disable body scrolling and hide non-map elements
document.title = options.title
document.body.classList.add('defra-map-body')
document.documentElement.classList.add('defra-map-html')

// Create the map container element
const containerElement = document.createElement('div')
Expand Down Expand Up @@ -256,6 +257,7 @@ window.flood.maps.MapContainer = function MapContainer (mapId, options) {
document.title = options.originalTitle
// Unlock body scroll
document.body.classList.remove('defra-map-body')
document.documentElement.classList.remove('defra-map-html')
clearAllBodyScrollLocks()
// Remove map and return focus
containerElement.parentNode.removeChild(containerElement)
Expand Down Expand Up @@ -436,9 +438,11 @@ window.flood.maps.MapContainer = function MapContainer (mapId, options) {

// Mouse or touch interaction
containerElement.addEventListener('pointerdown', (e) => {
infoElement.blur()
keyElement.blur()
viewport.removeAttribute('keyboard-focus')
// Address OpenLayers performance bug when viewport has focus?
if (document.activeElement === viewport) {
exitMapButtonElement.focus()
}
})

// Disable pinch and double tap zoom
Expand Down
6 changes: 6 additions & 0 deletions server/src/sass/components/map/_map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
@include defra-visually-hidden;
}
}
.defra-map-html {
height: 100vh;
}
.defra-map-body {
position: fixed;
overflow: hidden;
Expand All @@ -40,6 +43,9 @@
bottom:0px;
left:0px;
}
.defra-map-visibility-hidden {
visibility: hidden;
}
.defra-map-viewport {
-webkit-touch-callout: none;
-webkit-user-select: none;
Expand Down

0 comments on commit 074a882

Please sign in to comment.