/// @param {Keyword} $size - Breakpoint to use. **Must be a breakpoint defined in `$breakpoints`.**
@mixin show-for($size) {
$size: map-get($breakpoints, $size);
- $size: -zf-bp-to-em($size) - .00001;
+ // Max value is 0.2px under the next breakpoint (0.02 / 16 = 0.00125).
+ // Use a precision under 1px to support browser zoom, but not to low to avoid rounding.
+ // See https://github.com/zurb/foundation-sites/issues/11313
+ $size: -zf-bp-to-em($size) - .00125;
@include breakpoint($size down) {
display: none !important;
$upper-bound-size: -zf-map-next($breakpoints, $size);
// more often than not this will be correct, just one time round the loop it won't so set in scope here
- $lower-bound: -zf-bp-to-em($lower-bound-size) - .00001;
+ $lower-bound: -zf-bp-to-em($lower-bound-size) - .00125;
// test actual lower-bound-size, if 0 set it to 0em
@if strip-unit($lower-bound-size) == 0 {
$lower-bound: -zf-bp-to-em($lower-bound-size);
// Convert any pixel, rem, or unitless value to em
$bp: -zf-bp-to-em($bp);
+ // Max value is 0.2px under the next breakpoint (0.02 / 16 = 0.00125).
+ // Use a precision under 1px to support browser zoom, but not to low to avoid rounding.
+ // See https://github.com/zurb/foundation-sites/issues/11313
@if $bp-max {
- $bp-max: -zf-bp-to-em($bp-max) - .00001;
+ $bp-max: -zf-bp-to-em($bp-max) - .00125;
}
// Conditions to skip media query creation
@include test('Breakpoint (Only Range) [function]') {
$test: breakpoint(medium only);
- $expect: '(min-width: 40em) and (max-width: 63.99999em)';
+ $expect: '(min-width: 40em) and (max-width: 63.99875em)';
$test-lowest: breakpoint(small only);
- $expect-lowest: '(max-width: 39.99999em)';
+ $expect-lowest: '(max-width: 39.99875em)';
$test-highest: breakpoint(xxlarge only);
$expect-highest: '(min-width: 90em)';
@include test('Breakpoint (Named Down Range) [function]') {
$test: breakpoint(medium down);
- $expect: '(max-width: 63.99999em)';
+ $expect: '(max-width: 63.99875em)';
@include assert-equal($test, $expect,
'Creates a down range out of a medium breakpoint');
$test-lowest: breakpoint(small down);
- $expect-lowest: '(max-width: 39.99999em)';
+ $expect-lowest: '(max-width: 39.99875em)';
@include assert-equal($test-lowest, $expect-lowest,
'Creates a down range out of a small breakpoint');