+
[% INCLUDE 'alert/_updates.html' %]
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 9c1ac4cdd8e..04b1f051abf 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -20,28 +20,67 @@ function isR2L() {
// A sliding drawer from the bottom of the page, small version
// that doesn't change the main content at all.
small_drawer: function(id) {
- var $this = $(this), d = $('#' + id);
+ var $this = $(this), d = $('#' + id),
+ keyboardTriggered = false,
+ previousFocus;
+
+ this.on('keydown', function(e) {
+ if (e.key === 'Enter' || e.key === ' ') {
+ keyboardTriggered = true;
+ }
+ });
+
this.on('click', function(e) {
e.preventDefault();
+ previousFocus = $(document.activeElement);
if (!$this.hasClass('hover')) {
if (opened) {
opened.trigger('click');
}
if (!$this.addClass('hover').data('setup')) {
+ var parentWidth = d.parent().width();
+ var isMobile = $('html').hasClass('mobile');
+ var bottomValue = ( $(window).height() - $this.offset().top + 3 ) + 'px';
d.hide().removeClass('hidden-js').css({
padding: '1em',
- background: '#fff'
+ background: '#fff',
+ position: 'fixed',
+ top: isMobile ? '0' : '',
+ left: '0',
+ bottom: isMobile ? '' : bottomValue,
+ 'z-index': 9999,
+ width: isMobile ? '100vw' : parentWidth
});
$this.data('setup', true);
}
- d.slideDown();
+ d.slideDown(function() {
+ $this.attr('aria-expanded', 'true');
+ // We want to focus on first focusable element inside the drawer, but only if the user has use the keyboard. It is a bit odd having this behaviour when using the mouse.
+ if (keyboardTriggered) {
+ d.find('a, button, input, select, textarea').first().focus();
+ keyboardTriggered = false;
+ }
+ });
opened = $this;
} else {
$this.removeClass('hover');
- d.slideUp();
+ d.slideUp(function() {
+ $this.attr('aria-expanded', 'false');
+ });
opened = null;
}
});
+
+ d.on('click', '.close-drawer', function() {
+ $this.removeClass('hover');
+ d.slideUp(function() {
+ $this.attr('aria-expanded', 'false');
+ if (previousFocus) {
+ previousFocus.focus();
+ }
+ });
+ opened = null;
+ });
},
// A sliding drawer from the bottom of the page, large version
@@ -98,7 +137,7 @@ function isR2L() {
// Insert the .shadow-wrap controls into the top of the drawer.
$sw.addClass('static').prependTo($drawer);
- $('#key-tools').addClass('area-js');
+ $('.js-key-tools').addClass('area-js');
$('#key-tool-wards').addClass('hover');
// Animate the drawer into place, enitrely covering the sidebar.
@@ -1361,8 +1400,12 @@ $.extend(fixmystreet.set_up, {
$('#key-tool-wards').drawer('council_wards', false);
$('#key-tool-around-updates').drawer('updates_ajax', true);
}
- $('#key-tool-report-updates').small_drawer('report-updates-data');
- $('#key-tool-report-share').small_drawer('report-share');
+ $('.js-key-tool-report-updates').each(function() {
+ $(this).small_drawer('report-updates-data');
+ });
+ $('.js-key-tool-report-share').each(function() {
+ $(this).small_drawer('report-share');
+ });
},
ward_select_multiple: function() {
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index f04fb9703c3..353d34f8e7c 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -1020,6 +1020,8 @@ html.mobile.js-nav-open #js-menu-open-modal {
}
#report-updates-data {
+ box-sizing: border-box;
+ box-shadow: 0px 10px 5px 2px rgba(0,0,0,0.15);
img {
float: $right;
}
@@ -1031,6 +1033,8 @@ html.mobile.js-nav-open #js-menu-open-modal {
}
#report-share {
+ box-sizing: border-box;
+ box-shadow: 0px 10px 5px 2px rgba(0,0,0,0.15);
.btn {
padding-#{$left}: 1.5em;
padding-#{$right}: 1.5em;
diff --git a/web/cobrands/sass/_layout.scss b/web/cobrands/sass/_layout.scss
index c6450119d72..88ab1d4a796 100644
--- a/web/cobrands/sass/_layout.scss
+++ b/web/cobrands/sass/_layout.scss
@@ -704,6 +704,7 @@ body.authpage {
// If JS is disabled, these are still CSS positioned, so don't want behind shining through.
#report-share, #report-updates-data {
background-color: #fff;
+ box-shadow: 0px -10px 5px -1px rgba(0,0,0,0.15);
}
// Prevent gap in non-JS, and looks better with JS, due to some padding/margin effect.
#report-updates-data fieldset {