Closed Bug 2049218 Opened 5 months ago Closed 11 hours ago

New Tab shortcuts positioned too high when widgets and stories are disabled

Categories

(Firefox :: New Tab Page, defect, P3)

Desktop
Unspecified
defect

Tracking

()

RESOLVED FIXED
163 Branch
Tracking Status
firefox154 --- affected
firefox163 --- fixed

People

(Reporter: 08xjcec48, Assigned: egg, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [hnt][lang=js][lang=css])

Attachments

(1 file, 1 external file)

Attached image image.png —
  • Maximize your Firefox window
  • Open about:preferences#home
  • Uncheck everything but Shortcuts
  • Open a new tab

Result: your shortcuts are displayed at the top of an otherwise empty page.

Expected results: the same position as when you set browser.newtabpage.activity-stream.nova.enabled to false.

Severity: -- → S3
Priority: -- → P3
Whiteboard: [hnt]

Filing as a good first bug to learn workflows.

When the only thing on New Tab is Shortcuts, the shortcuts sit at the top of an otherwise empty page. Before the Nova UI update, this content was vertically centered.

Steps to reproduce:

  1. Open about:preferences#home
  2. Uncheck everything except Shortcuts (search, stories, and widgets off)
  3. Open a new tab

The page is now a grid that stacks rows from the top, so nothing centers it vertically. For this bug, please only handle the case where search is off. Search has its own sticky positioning and is out of scope.

Recommended approach:

  • In Base.jsx, near isPageEmpty, add a boolean that is true when top sites are enabled and stories, recent activity (highlights), search and all widgets are off. When it's true, add a class such as top-sites-only to the .container nova-enabled element.
  • In _Grid.scss, give that container a minimum height and center its rows. Something like this works well:
  .nova-enabled.container.top-sites-only {
    align-content: center;
    min-height: 75vh;
  }

Please set the class from JS rather than detecting this state with a :has() selector in CSS.

Link to the code:
https://searchfox.org/firefox-main/rev/2d5c2a4eb5d99a92249ec13370b1de9c1a77c0f8/browser/extensions/newtab/content-src/components/Base/Base.jsx#1162
https://searchfox.org/firefox-main/rev/2d5c2a4eb5d99a92249ec13370b1de9c1a77c0f8/browser/extensions/newtab/content-src/components/Base/_Grid.scss#415

To verify the fix:
./mach build faster
./mach run
Then check that the shortcuts sit near the vertical middle of the page, and that turning on search, stories or any widget brings back the normal layout.

Before submitting, run the linter:
./mach lint --fix browser/extensions/newtab/content-src/components/Base/

It would be nice to add a test in browser/extensions/newcomponents/Base.test.jsx checking that the class is added only in this state. You can run the tests with:
./mach npm test --prefix=browser/extensions/newtab

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/con
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Mentor: ini
Keywords: good-first-bug
Whiteboard: [hnt] → [hnt][lang=js][lang=css]
Assignee: nobody → tomeggleston2436
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 11 hours ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: