We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b36ab2e commit db846beCopy full SHA for db846be
1 file changed
src/tinyTag/index.tsx
@@ -18,7 +18,7 @@ const useSvgWidth = (): UseSvgWidthResult => {
18
const getWidth = useCallback(() => {
19
if (!element) return;
20
const paddingWidth = 8;
21
- const textWidth = Math.round(element.getBoundingClientRect()?.width);
+ const textWidth = Math.round(element.getComputedTextLength?.() ?? 0);
22
const svgWidth = textWidth + paddingWidth;
23
setSvgWidth(svgWidth);
24
setRectWidth(Math.max(svgWidth - 1, 0));
0 commit comments