Skip to content

Commit 8d16a96

Browse files
Aniket-pdih-codes
andauthored
Bugfix FXIOS-29410 [Menu] Fix overlap of “Protections are ON” label with domain name at large text sizes (#29429)
* Update site protections header layout constraints Refactored MenuSiteProtectionsHeader to use prioritized top constraints for siteProtectionsContent, improving alignment and flexibility. Adjusted leading anchor to align with contentLabels and applied horizontal padding offset. * Update MenuSiteProtectionsHeader.swift Co-authored-by: Isabella <[email protected]> --------- Co-authored-by: Isabella <[email protected]>
1 parent 1012303 commit 8d16a96

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

BrowserKit/Sources/MenuKit/MenuSiteProtectionsHeader.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,17 @@ public final class MenuSiteProtectionsHeader: UIView, ThemeApplicable {
122122
siteProtectionsContent.addArrangedSubview(siteProtectionsLabel)
123123
siteProtectionsContent.addArrangedSubview(siteProtectionsMoreSettingsIcon)
124124

125+
let siteProtectionsTopFromFavicon = siteProtectionsContent.topAnchor.constraint(
126+
greaterThanOrEqualTo: favicon.bottomAnchor,
127+
constant: UX.siteProtectionsContentTopMargin
128+
)
129+
130+
let siteProtectionsTopFromLabels = siteProtectionsContent.topAnchor.constraint(
131+
equalTo: contentLabels.bottomAnchor,
132+
constant: UX.siteProtectionsContentTopMargin
133+
)
134+
siteProtectionsTopFromLabels.priority = .defaultHigh
135+
let iconAlignmentOffset = -UX.siteProtectionsContentHorizontalPadding
125136
NSLayoutConstraint.activate([
126137
contentLabels.topAnchor.constraint(equalTo: self.topAnchor),
127138
contentLabels.trailingAnchor.constraint(equalTo: closeButton.leadingAnchor,
@@ -139,14 +150,17 @@ public final class MenuSiteProtectionsHeader: UIView, ThemeApplicable {
139150
siteProtectionsIcon.widthAnchor.constraint(equalToConstant: UX.siteProtectionsIcon),
140151
siteProtectionsMoreSettingsIcon.widthAnchor.constraint(equalToConstant: UX.siteProtectionsMoreSettingsIcon),
141152

142-
siteProtectionsContent.topAnchor.constraint(equalTo: favicon.bottomAnchor,
143-
constant: UX.siteProtectionsContentTopMargin),
153+
siteProtectionsTopFromLabels,
154+
siteProtectionsTopFromFavicon,
144155
siteProtectionsContent.trailingAnchor.constraint(lessThanOrEqualTo: closeButton.leadingAnchor),
145156
siteProtectionsContent.bottomAnchor.constraint(equalTo: self.bottomAnchor),
146157

147158
closeButton.widthAnchor.constraint(equalToConstant: UX.closeButtonSize),
148159
closeButton.heightAnchor.constraint(equalToConstant: UX.closeButtonSize),
149-
siteProtectionsContent.leadingAnchor.constraint(equalTo: favicon.leadingAnchor)
160+
siteProtectionsContent.leadingAnchor.constraint(
161+
equalTo: contentLabels.leadingAnchor,
162+
constant: iconAlignmentOffset
163+
)
150164
])
151165

152166
closeButton.layer.cornerRadius = 0.5 * UX.closeButtonSize

0 commit comments

Comments
 (0)