From 62e8b1d5b3dc0796e6d93017d08e9d4ddfcfa1c0 Mon Sep 17 00:00:00 2001 From: dicarobinho <61138287+dicarobinho@users.noreply.github.com> Date: Wed, 6 Nov 2024 17:41:59 +0200 Subject: [PATCH] =?UTF-8?q?Bugfix=20FXIOS-10442=20=E2=81=83=20[Menu]=20Fix?= =?UTF-8?q?=20UI=20issues=20for=20the=20profile=20icon=20on=20the=20menu?= =?UTF-8?q?=20(#22930)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FXIOS-10442 #22855 ⁃ [Menu Redesign] Fix UI issues for the profile icon on the menu * Update firefox-ios/Client/Frontend/Strings.swift --------- Co-authored-by: roux g. buciu <11182210+adudenamedruby@users.noreply.github.com> (cherry picked from commit 53c43259826847020096d5825579fd3c8340ed5e) --- .../Sources/ComponentLibrary/Headers/HeaderView.swift | 8 +++++--- .../Browser/MainMenu/MainMenuConfigurationUtility.swift | 4 ++-- firefox-ios/Client/Frontend/Strings.swift | 8 ++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/BrowserKit/Sources/ComponentLibrary/Headers/HeaderView.swift b/BrowserKit/Sources/ComponentLibrary/Headers/HeaderView.swift index 4ad96f23751a..22d21a465e5f 100644 --- a/BrowserKit/Sources/ComponentLibrary/Headers/HeaderView.swift +++ b/BrowserKit/Sources/ComponentLibrary/Headers/HeaderView.swift @@ -12,7 +12,7 @@ public final class HeaderView: UIView, ThemeApplicable { static let siteDomainLabelsVerticalSpacing: CGFloat = 12 static let largeFaviconImageSize: CGFloat = 48 static let favIconImageSize: CGFloat = 32 - static let smallFaviconImageSize: CGFloat = 20 + static let smallFaviconImageSize: CGFloat = 24 static let maskFaviconImageSize: CGFloat = 32 static let horizontalMargin: CGFloat = 16 static let headerLabelDistance: CGFloat = 2 @@ -90,10 +90,12 @@ public final class HeaderView: UIView, ThemeApplicable { warningIconView.removeConstraints(warningIconView.constraints) iconMask.removeConstraints(iconMask.constraints) viewConstraints.removeAll() + let favIconPadding = (UX.maskFaviconImageSize / 2) - (UX.smallFaviconImageSize / 2) + let favIconLeadingConstant = isWebsiteIcon ? UX.horizontalMargin : UX.horizontalMargin + favIconPadding viewConstraints.append(contentsOf: [ favicon.leadingAnchor.constraint( equalTo: self.leadingAnchor, - constant: UX.horizontalMargin + constant: favIconLeadingConstant ), headerLabelsContainer.topAnchor.constraint( @@ -105,7 +107,7 @@ public final class HeaderView: UIView, ThemeApplicable { constant: -UX.siteDomainLabelsVerticalSpacing ), headerLabelsContainer.leadingAnchor.constraint( - equalTo: favicon.trailingAnchor, + equalTo: isWebsiteIcon ? favicon.trailingAnchor : iconMask.trailingAnchor, constant: UX.siteDomainLabelsVerticalSpacing ), headerLabelsContainer.trailingAnchor.constraint( diff --git a/firefox-ios/Client/Frontend/Browser/MainMenu/MainMenuConfigurationUtility.swift b/firefox-ios/Client/Frontend/Browser/MainMenu/MainMenuConfigurationUtility.swift index 4e3f7135e617..e491de277444 100644 --- a/firefox-ios/Client/Frontend/Browser/MainMenu/MainMenuConfigurationUtility.swift +++ b/firefox-ios/Client/Frontend/Browser/MainMenu/MainMenuConfigurationUtility.swift @@ -389,7 +389,7 @@ struct MainMenuConfigurationUtility: Equatable { isEnabled: readerModeState != .unavailable, isActive: readerModeState == .active, a11yLabel: a11yLabel, - a11yHint: "", + a11yHint: readerModeState != .unavailable ? "" : .MainMenu.AccessibilityLabels.OptionDisabledHint, a11yId: AccessibilityIdentifiers.MainMenu.readerView, action: { store.dispatch( @@ -527,7 +527,7 @@ struct MainMenuConfigurationUtility: Equatable { isEnabled: tabInfo.readerModeIsAvailable, isActive: tabInfo.isInReadingList, a11yLabel: a11yLabel, - a11yHint: "", + a11yHint: tabInfo.readerModeIsAvailable ? "" : .MainMenu.AccessibilityLabels.OptionDisabledHint, a11yId: AccessibilityIdentifiers.MainMenu.saveToReadingList, action: { store.dispatch( diff --git a/firefox-ios/Client/Frontend/Strings.swift b/firefox-ios/Client/Frontend/Strings.swift index 2b38fdeb173c..b5e4753e0169 100644 --- a/firefox-ios/Client/Frontend/Strings.swift +++ b/firefox-ios/Client/Frontend/Strings.swift @@ -3895,6 +3895,14 @@ extension String { // MARK: - Main Menu extension String { public struct MainMenu { + public struct AccessibilityLabels { + public static let OptionDisabledHint = MZLocalizedString( + key: "MainMenu.AccessibilityLabels.OptionDisabled.Hint.v133", + tableName: "MainMenu", + value: "Dimmed", + comment: "On the main menu, the accessibility label hint for any action/option inside the menu, that is disabled. For example: 'Save to Reading List' option, from Menu, in some cases is disabled and the voice over should indicate that. 'Save To Reading List dimmed'") + } + public struct Account { public static let SignedOutTitle = MZLocalizedString( key: "MainMenu.Account.SignedOut.Title.v131",