Skip to content

Commit

Permalink
[Dialogs] Fix vertical calculations for wide actions view (material-c…
Browse files Browse the repository at this point in the history
…omponents#9878)

This issue is specific to alerts with actions that are wider than the title and the message. The width of the alert, which is based on its widest part (in this case the actions) did not include the insets in the width, causing differences in calculating the final width of the alerts, and cause long actions to be truncated (Closes #8434).

PiperOrigin-RevId: 299735845
  • Loading branch information
galiak11 authored Mar 15, 2020
1 parent 6ec85ff commit a265dad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,12 @@ - (CGSize)actionButtonsSizeInVerticalLayout {
NSArray<MDCButton *> *buttons = self.actionManager.buttonsInActionOrder;
if (0 < buttons.count) {
size.height = self.actionsInsets.top + self.actionsInsets.bottom;
size.width = self.actionsInsets.left + self.actionsInsets.right;
CGFloat widthInset = self.actionsInsets.left + self.actionsInsets.right;
for (UIButton *button in buttons) {
CGSize buttonSize = [button sizeThatFits:size];
buttonSize.height = MAX(buttonSize.height, MDCDialogActionButtonMinimumHeight);
size.height += buttonSize.height;
size.width = MAX(size.width, buttonSize.width);
size.width = MAX(size.width, buttonSize.width + widthInset);
if (button != buttons.lastObject) {
size.height += self.actionsVerticalMargin;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a265dad

Please sign in to comment.