Problem/Motivation

The viewport switcher assumed breakpoint widths were whole numbers in px. Breakpoints in em, like the ones in ui_suite_dsfr_utilities, broke in three ways:

  • Every em breakpoint got the generic aspect-ratio icon instead of a device icon.
  • Decimal widths like max-width: 35.98em didn't parse, so the breakpoint disappeared.
  • Duplicate removal used a 2-unit threshold, which is 32px in em. Separate breakpoints like 36em and 38em merged into one button.

Media queries resolve em and rem against 16px. The switcher now converts em and rem to px at 16px for icons and duplicate removal, and reads widths as floats. Unit tests cover parsing, icons and duplicate removal.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mogtofu33 created an issue. See original summary.

  • mogtofu33 committed befeaa6f on 1.0.x
    feat: #3622476 enhance ViewportSwitcher with unit tests for width...
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.