Skip to content

WARNING Potentially invalid value for $container-max-widths #24061

@romanlex

Description

@romanlex

Hello, I have warning when trying compile styles with this variables:

$container-max-widths: (
				sm: 540px,
				md: 720px,
				lg: 960px,
				xl: 92%
);
@include _assert-ascending($container-max-widths, "$container-max-widths");

Message:
WARNING: Potentially invalid value for $container-max-widths: This map must be in ascending order, but key 'xl' has value 92% whose unit makes it incomparable to 960px, the value of the previous key 'lg' !

I think what this block is wrong and should ignore the specified values in percentage

@each $key, $num in $map {
    @if $prev-num == null {
      // Do nothing
    } @else if not comparable($prev-num, $num) {
      @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
    } @else if $prev-num >= $num {
      @warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
    }
    $prev-key: $key;
    $prev-num: $num;
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions