The environment tells us where to look before any test is run. In this project the relevant conditions were:
- React was in use, though it isn't required to follow the investigation.
- The SVGs are imported as React components and inlined into the HTML by webpack.
- The files came out of a design tool with no syntax errors.
- A stylesheet applies CSS to the graphics.
- The affected SVGs sit inside
<button>elements. - Safari is the only browser affected; the problem was observed on version 13.
The first suspicion is CSS: a hover style breaking the layout or the overflow behavior of the graphic, with the fault surfacing whenever Safari paints the page. That gives us a working assumption to test rather than a conclusion, and a Safari rendering bug triggered by a particular style on the SVG — a flex layout, say — is a plausible variant.
Eliminating CSS
Problem simplification, described in Cornell University's CS lecture as "an approach to gradually eliminate portions of the code that are not relevant to the bug," is the right tool here. If CSS is the cause, disabling the project's non-browser stylesheets should make the bug disappear. Commenting out the stylesheet import was the first test:
import 'css/app.css';
A separate CodePen reproduces the elements with no CSS at all. In Safari the bug still occurs — the CodePen requires a button click to force it, whereas it can also appear on load. CSS is therefore not the culprit, but the test surfaces a new fact: only two of the five buttons break under this condition. Worth holding onto.

Isolating a single button
The next hypothesis is that Safari mis-renders an SVG inside an HTML <button> element. Sarah Drasner's writing on isolation covers why this is such a strong technique:
Isolation is possibly the strongest core tenets in all of debugging. Our codebases can be sprawling, with different libraries, frameworks, and they can include many contributors, even people who aren't working on the project anymore. Isolating the problem helps us slowly whittle away non-essential parts of the problem so that we can singularly focus on a solution.
The reduced test case: move the broken button to an empty test route. CSS stays commented out even though it has been ruled out, to keep the problem as small as possible. In Safari the issue can no longer be reproduced — the graphic renders as expected after a click. That is not an acceptable fix, but it is the starting point for a minimal reproducible example.
Narrowing to the interaction between two graphics
The difference between the full page and the isolated case is which buttons are present. Trying every combination shows the bug occurs only when a paint event hits a larger SVG that shares a page with a smaller SVG. A minimal reproducible example now exists, and in it the two graphics appear to conflict: overlaying the second SVG over the first shows that the cropped area of the larger graphic matches the smaller graphic's exact dimensions.

Binary search through the SVG
What remains is the specific markup. A binary tree search — divide and conquer — works without a deep knowledge of SVG syntax. Cornell's lecture describes the idea:
For example, starting from a large piece of code, place a check halfway through the code. If the error doesn't show up at that point, it means the bug occurs in the second half; otherwise, it is in the first half.
The first cut removes <filter> and the already-empty <defs> from the first SVG. As Sara Soueidan's SVG filters primer explains, filters are never rendered directly: the <filter> element only exists to be referenced, via the filter attribute in SVG or the url() function in CSS. In this graphic the filter produces a subtle inset shadow at the bottom.
After the removal the shadow should be gone. It isn't — the inset bottom shadow still displays, and the bug now appears in every browser, not just Safari. So the fault lies in the rest of the markup. Deleting the remaining id from <g filter="url(#filter0_ii)"> removes the shadow entirely.
That points back at the definition quoted above: because a filter's only purpose is to be referenced by that id, the second SVG's filter definition is being applied to the first SVG graphic — and that is what breaks the render.
The evidence points at the <filter> property, and both SVGs use a filter for the inset shadow on the circle shape. Comparing the simplified markup for the two graphics shows the cause.
<svg width="46" height="46" viewBox="0 0 46 46">
<g filter="url(#filter0_ii)">
<!-- ... -->
</g>
<!-- ... -->
<defs>
<filter id="filter0_ii" x="0" y="0" width="46" height="46">
<!-- ... -->
</filter>
</defs>
</svg>
<svg width="28" height="28" viewBox="0 0 28 28">
<g filter="url(#filter0_ii)">
<!-- ... -->
</g>
<!-- ... -->
<defs>
<filter id="filter0_ii" x="0" y="0" width="28" height="28">
<!-- ... -->
</filter>
</defs>
</svg>
Both generated SVGs carry the same attribute value, id=filter0_ii. Safari applied whichever filter definition it read last — the second SVG's markup — so the first SVG was cropped to the dimensions of the second filter, shrinking from 46px to 28px. An id must be unique within the DOM; with two or more identical values on a page, browsers cannot tell which reference to follow, and the filter property is redefined on every paint event depending on the racing condition, which explains why the failure appeared at random.
Assigning unique id values to each SVG graphic fixes it: opening the CodePen example in Safari and clicking the button no longer reproduces the bug. Strictly speaking, a non-unique id is invalid everywhere, so the flaw should surface in all browsers. Chrome and Firefox happen to handle this edge case without a visible defect, though that may be coincidence.
What the debugging process contributed
The investigation moved from knowing almost nothing about an apparently random failure to a full understanding and a fix. UI and visual bugs are hard to chase when the cause is unclear or convoluted, but a few strategies carried the work:
- Hypotheses first: simplifying the problem eliminated components unrelated to the issue — style, markup, dynamic events.
- Isolation: narrowing to a minimal reproducible example reduced the scope to a single chunk of code.
- Divide and conquer: pinpointing the exact cause, then correcting it.
One more strategy, also covered in Cornell University's CS 312 lecture, is worth keeping: step away between attempts.
If too much time is spent on a bug, the programmer becomes tired and debugging may become counterproductive. Take a break, clear your mind; after some rest, try to think about the problem from a different perspective.



