Skip to content

Commit

Permalink
fix(color-contrast): fix font-weight calculation for safari
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Jun 16, 2020
1 parent b0f5562 commit 205b587
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/checks/color/color-contrast.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const fgColor = color.getForegroundColor(node, noScroll, bgColor);

const nodeStyle = window.getComputedStyle(node);
const fontSize = parseFloat(nodeStyle.getPropertyValue('font-size'));
const fontWeight = parseFloat(nodeStyle.getPropertyValue('font-weight'));
const bold = !isNaN(fontWeight) && fontWeight >= 700;
const fontWeight = nodeStyle.getPropertyValue('font-weight');
const bold = parseFloat(fontWeight) >= 700 || fontWeight === 'bold';

const cr = color.hasValidContrastRatio(bgColor, fgColor, fontSize, bold);

Expand Down

0 comments on commit 205b587

Please sign in to comment.