title: Clipping of overflowing div inside foreignObject during translate in Firefox
body: <p>I'm using D3.js to render <code>g</code> SVG elements, each containing a <code>foreignObject</code> so that I can attach a styled <code>div</code> text. The HTML looks like this:</p>
  
  <pre><code>&lt;g class=node ...&gt;
  
      &lt;circle ...&gt;&lt;/circle&gt;
      &lt;clipPath ...&gt;
          &lt;circle ...&gt;&lt;/circle&gt;
      &lt;/clipPath&gt;
      &lt;image ...&gt;&lt;/image&gt;
  
      &lt;foreignObject ...&gt;
          &lt;div ...&gt;...&lt;/div&gt;
      &lt;/foreignObject&gt;
  
  &lt;/g&gt;
  </code></pre>
  
  <p>There are 60 of these elements contained in a parent <code>g</code> element which is translated with <code>transform: translate(...)</code> when the user scrolls.</p>
  
  <p>Here, the <code>foreignObject</code> has <code>height=1</code> and <code>width=1</code> with <code>overflow: visible</code>. This allows the contained <code>div</code> to be sized based on the text it contains.</p>
  
  <p>This works fine on Chrome and Edge (and Safari if I remember correctly), however on Firefox, the <code>div</code> element inside <code>foreignObject</code> gets 'clipped' when I call <code>translate</code> on the parent <code>g</code> element. The image below shows the correct rendering:</p>
  
  <p><a href="https://i.stack.imgur.com/AGYk2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AGYk2.png" alt="correct rendering"></a></p>
  
  <p>And the image below shows the rendering during <code>translate</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/w5lBX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w5lBX.png" alt="enter image description here"></a></p>
  
  <p>I suspect this has something to do with the <code>width</code> and <code>height</code> of the <code>g</code> elements (i.e. <code>node</code> class) because the clipping occurs outside the boundary of <code>g</code>. How would I fix this? I've thought of using JavaScript to modify the <code>width</code> and <code>height</code> of <code>g</code>, but these attributes are based on the rendering which I don't know in advance.</p>
  
  <p>Any help is appreciated!</p>