Don't truncate tags unnecessarily if width is miscalculated

https://forums.zotero.org/discussion/76665/tag-issue-display-of-some-tags-erratic
This commit is contained in:
Dan Stillman 2019-03-31 07:37:24 -04:00
parent ecdcb65f57
commit 3ca5ac421c

View file

@ -132,6 +132,14 @@ class TagList extends React.PureComponent {
...style
};
// Don't specify explicit width unless we're truncating, because for some reason the width
// from canvas can sometimes be slightly smaller than the actual width, resulting in an
// unnecessary ellipsis.
var tagMaxWidth = this.props.width - minHorizontalPadding;
if (props.style.width < tagMaxWidth) {
delete props.style.width;
}
if (tag.color) {
props.style.color = tag.color;
}