From cdeddbadab176bbd3d9ed63c091d0ff942017070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20=C5=9Apiewak?= Date: Thu, 19 Dec 2024 10:15:05 +0100 Subject: [PATCH] Fix BrowsingMenu layout (#3712) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task/Issue URL: https://app.asana.com/0/414709148257752/1208946169184139/f Tech Design URL: CC: **Description**: Adjusts layout for `BrowsingMenuButton` so that it expands along with the label inside. Additionally `BrowsingMenuViewController` got a new constraint preventing the menu view from going outside view bounds. **Steps to test this PR**: 1. Enable link conditioner with a bad/slow connection profile. 2. Try to load any site, stop before it finishes loading. 3. Open menu, check if button titles are visible. 4. Load site again (without link conditioner). 5. Check browsing menu sizing and layout is as expected. 6. Go to System Settings -> Developer -> View (simulator) or Display & Brightness -> Display Zoom (physical device) and set display zoom to "Larger text". 7. Repeat testing steps. **Definition of Done (Internal Only)**: * [ ] Does this PR satisfy our [Definition of Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)? **Orientation Testing**: * [ ] Portrait * [ ] Landscape **Device Testing**: * [x] iPhone SE (1st Gen) * [x] iPhone 8 * [ ] iPhone X * [x] iPhone 14 Pro * [x] iPad **OS Testing**: * [ ] iOS 15 * [ ] iOS 16 * [ ] iOS 17 --- ###### Internal references: [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) --- .../BrowsingMenu/BrowsingMenuButton.xib | 39 ++++++------ .../BrowsingMenuViewController.storyboard | 60 +++++++++---------- ...bViewControllerBrowsingMenuExtension.swift | 5 +- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/DuckDuckGo/BrowsingMenu/BrowsingMenuButton.xib b/DuckDuckGo/BrowsingMenu/BrowsingMenuButton.xib index 6936ad96a9..358b28ef66 100644 --- a/DuckDuckGo/BrowsingMenu/BrowsingMenuButton.xib +++ b/DuckDuckGo/BrowsingMenu/BrowsingMenuButton.xib @@ -1,39 +1,36 @@ - + - + - - + + - + - + - diff --git a/DuckDuckGo/BrowsingMenu/BrowsingMenuViewController.storyboard b/DuckDuckGo/BrowsingMenu/BrowsingMenuViewController.storyboard index c15ecff942..9b439b5901 100644 --- a/DuckDuckGo/BrowsingMenu/BrowsingMenuViewController.storyboard +++ b/DuckDuckGo/BrowsingMenu/BrowsingMenuViewController.storyboard @@ -1,9 +1,10 @@ - + - + + @@ -12,10 +13,6 @@ - - - - @@ -28,10 +25,10 @@ - + - + @@ -39,43 +36,44 @@ - + - + - - + + - - + + + - + - + - + - + - + @@ -87,7 +85,7 @@ - + @@ -133,20 +131,20 @@ - + - + - + - + @@ -196,18 +194,20 @@ + - + - + + - + - - + + diff --git a/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift b/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift index fe6b117e86..4dc0613771 100644 --- a/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift +++ b/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift @@ -128,7 +128,10 @@ extension TabViewController { })) } - entries.append(.separator) + // Do not add separator if there are no entries so far + if entries.count > 0 { + entries.append(.separator) + } let shortcutsEntries = buildShortcutsEntries(includeBookmarks: false) entries.append(contentsOf: shortcutsEntries)