We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd1b389 commit 3fd935eCopy full SHA for 3fd935e
src/Truncate.js
@@ -127,7 +127,11 @@ export default class Truncate extends Component {
127
return;
128
}
129
130
- const targetWidth = target.parentNode.getBoundingClientRect().width;
+ const targetParentStyles = window.getComputedStyle(target.parentNode);
131
+ const targetParentPadding = parseFloat(targetParentStyles.paddingLeft) +
132
+ parseFloat(targetParentStyles.paddingRight);
133
+ const targetWidth = target.parentNode.getBoundingClientRect().width -
134
+ targetParentPadding;
135
136
// Delay calculation until parent node is inserted to the document
137
// Mounting order in React is ChildComponent, ParentComponent
0 commit comments