question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange checkbox rendering in `ActionList` with `shape-rendering: crispedges;` in Chrome

See original GitHub issue

Describe the bug

After upgrading to the latest version of primer/react in the new Projects experience, I noticed that the checkboxes look strange

image

I believe that this is due to the fact that the checkboxes are now using a <rect /> for the checkbox as of:

https://github.com/primer/react/commit/250e4b00f4d996b6125d381bae2487b57156687c#diff-008c41e7105eb2bb0be2768425e46a21944dcbffc988ca984f91d3d11d280efdR339-R348

Now that we’re using a <rect /> there, in projects, which is hosted in github.com and will have all the css from github.com in its stylesheet, those icons are getting affected by a global style rule:

rect {
    shape-rendering: crispedges;
}

In MacOS + Chrome, on a non-retina display, the checkboxes are rendered like the screenshot above. In other environments (or if I move the browser window to my laptop’s display), the checkboxes are rendered normally. Also, if I add a style rule of:

rect {
    shape-rendering: auto;
}

the checkboxes look how I would expect.

I can reproduce in the PRC storybook, by manually adding that rule (the bottom checkbox has crispedges the top does not`):

image

We could come up with a projects-specific fix, but that would mean that other consumers of PRC that are hosted in the github.com environment might have to come up with a similar fix, so I wasn’t sure if it was worth it to add something like shape-rendering: auto to the component in PRC (if that is indeed the correct fix).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
simuraicommented, Dec 6, 2021

There were talks about visual regression testing in the past few years. But as of today it’s still a manual process:

  1. Deploy to review-lab
  2. Click around to see if something looks off

I know, it sounds a bit tedious and risky… and it is.

1reaction
simuraicommented, Dec 3, 2021

@siddharthkp Based on the PR https://github.com/github/github/pull/2373 where it was added, I think initially it was meant for those Insights graphs? E.g. making those bars in https://github.com/primer/react/graphs/commit-activity look sharp:

image

Yeah, would be great to limit the scope a bit. Hard to say, but maybe to g.bar rect. Or the more generic .graphs rect. I’ll add it to our backlog. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

1381 - SVG shape-rendering="crispEdges" not honoured
Issue 1381: SVG shape-rendering="crispEdges" not honoured. Reported by schedule andy. ... Safari and Chrome screenshots attached. ChromeCrisp.png.
Read more >
shape-rendering - SVG: Scalable Vector Graphics | MDN
The shape-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering shapes like paths, circles, ...
Read more >
SVG rendering issues in chrome for tiny elements
Add shape-rendering="crispEdges" to your svg eleement. Chrome makes different anti-aliasing choices for drawing than Firefox/Safari - so ...
Read more >
Checkbox not rendering properly in chrome and safari, but in ...
Hi, I am using oj-checkboxset in my project. They are coming properly in Firefox. But having issues in chrome and safari.
Read more >
[Solved] checkbox & radio button rendering issue - CodeProject
In my css file I had put the statement: CSS. form input, form select, form textarea { -webkit-appearance: none; }
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found