[Bugfix: Text] Fix ballooning SVG dimensions on Firefox #1854
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🐛 Bug Fix
Hey guys! Recently noticed that
Text
's svg wrapper blows up to max width/height on Firefox. This has the impact of inflating the parent container as well, and generally polluting the DOM inaccurately sized containers.This is an accepted implementation difference between Firefox and Safari/Chrome for SVGs with 0 width/height. And,
Text
is still displaying correctly. However, this behavior is a barrier in implementing dynamic layouts, since 1Text
element can mess up significant portions of the DOM with inaccurately sized elements. For example, I noticed this issue manifesting viaAxis
, where it was bubbling up from the tickLabel'sText
components.Visx is so powerful because it abstracts finicky SVG components - so ideally, I think
Text
should be browser agnostic and handle this svg "quirk" on its own.Let me know what you think! Thanks!
Axis on Firefox with this issue:
Axis on Firefox after fix:
Axis on Chrome (before and after)