Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit a801760

Browse files
codeman7material-automation
authored andcommitted
#Button Fix issue where legacy clients can't set borderWidth.
PiperOrigin-RevId: 751476068
1 parent 91a227c commit a801760

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

components/M3CButton/src/M3CButton.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,18 @@ - (void)updateInsets {
452452
}
453453

454454
- (void)setBorderWidth:(CGFloat)borderWidth {
455-
self.visualBackground.layer.borderWidth = borderWidth;
455+
if (_buttonSizeSet) {
456+
self.visualBackground.layer.borderWidth = borderWidth;
457+
} else {
458+
self.layer.borderWidth = borderWidth;
459+
}
456460
}
457461

458462
- (CGFloat)borderWidth {
459-
return self.visualBackground.layer.borderWidth;
463+
if (_buttonSizeSet) {
464+
return self.visualBackground.layer.borderWidth;
465+
}
466+
return self.layer.borderWidth;
460467
}
461468

462469
- (void)setTextCanWrap:(BOOL)textCanWrap {

0 commit comments

Comments
 (0)