Skip to content

Commit fd92685

Browse files
author
Hwashiang Yu
committed
MC-3688: Button text wraps to new line instead of increasing button width
- Updated widget to use min-width instead of width - Updated widget to listen to window resizing to update min-width
1 parent 8fff6bb commit fd92685

File tree

1 file changed

+5
-2
lines changed
  • app/code/Magento/PageBuilder/view/frontend/web/js/content-type/buttons/appearance/inline

1 file changed

+5
-2
lines changed

app/code/Magento/PageBuilder/view/frontend/web/js/content-type/buttons/appearance/inline/widget.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,25 @@ define([
1414
*/
1515
var equalizeButtonWidth = function (buttonList) {
1616
var buttonMinWidth = 0;
17-
17+
buttonList.css('min-width', buttonMinWidth);
1818
buttonList.each(function () {
1919
var buttonWidth = this.offsetWidth;
2020

2121
if (buttonWidth > buttonMinWidth) {
2222
buttonMinWidth = buttonWidth;
2323
}
2424
});
25-
buttonList.css('width', buttonMinWidth);
25+
buttonList.css('min-width', buttonMinWidth);
2626
};
2727

2828
return function (config, element) {
2929
var $element = $(element);
3030

3131
if ($element.data('sameWidth')) {
3232
equalizeButtonWidth($element.find('[data-element="link"]'));
33+
$( window ).resize(function() {
34+
equalizeButtonWidth($element.find('[data-element="link"]'));
35+
});
3336
}
3437
};
3538
});

0 commit comments

Comments
 (0)