diff --git a/src/label/labelStyle.ts b/src/label/labelStyle.ts index 7d294232d2..bb8b6aaa79 100644 --- a/src/label/labelStyle.ts +++ b/src/label/labelStyle.ts @@ -682,6 +682,11 @@ function setTokenTextStyle( textStyle.borderColor = inheritColor; } } + // If height or width is set but no backgroundColor, set transparent background + // to ensure the box constraints are applied + if ((textStyle.height != null || textStyle.width != null) && textStyle.backgroundColor == null) { + textStyle.backgroundColor = 'transparent'; + } } export function getFont( diff --git a/test/axis-label-height-without-bg.html b/test/axis-label-height-without-bg.html new file mode 100644 index 0000000000..6bc64f7ab6 --- /dev/null +++ b/test/axis-label-height-without-bg.html @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + +