Fix CSS that removes rounded corners on controls

Users on devices/browsers that support touch have
the rounded corners styles applied by this
selector:

.leaflet-touch .leaflet-bar a:first-child,
.leaflet-touch .leaflet-bar a:last-child

It has a higher precedence than the existing
selector we use to override it so our overrides
are ignored:

.leaflet-bar a:first-child,
.leaflet-bar a:last-child

This changes the selector for our block of styles
to include one matching the existing styles above
so devices/browsers also get our styles.

Note 1: this actually means some styles were no
longer needed so this also removes them.

Note 2: oddly, this was spotted in Firefox when
displaying high contrast mode on desktop. So not a
touch device but leaflet's JS is marking it as
such.
This commit is contained in:
Tom Byers
2021-08-26 11:51:44 +01:00
parent 8827b8802e
commit 4950b08d71

View File

@@ -61,20 +61,10 @@ $zoom-button-hover-colour: govuk-shade($zoom-button-colour, 10%);
a {
&:first-child {
// Remove rounded corners
border-top-left-radius: 0;
border-top-right-radius: 0;
}
&:last-child {
// Allow it to contain the absolutely positioned divider bar we show between buttons
// when one is focused
position: relative;
// Remove rounded corners
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
// Hover style is darker background
@@ -142,11 +132,21 @@ $zoom-button-hover-colour: govuk-shade($zoom-button-colour, 10%);
}
// Extra block to override specific LeafletJS rounded-corners when buttons are focused
.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
&:first-child:focus,
&:last-child:focus {
border-radius: initial;
&:first-child {
// Remove rounded corners
border-top-left-radius: 0;
border-top-right-radius: 0;
}
&:last-child {
// Remove rounded corners
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
}
// Map attribution links