New Tab shortcuts positioned too high when widgets and stories are disabled
Categories
(Firefox :: New Tab Page, defect, P3)
Tracking
()
People
(Reporter: 08xjcec48, Assigned: egg, Mentored)
References
Details
(Keywords: good-first-bug, Whiteboard: [hnt][lang=js][lang=css])
Attachments
(1 file, 1 external file)
|
33.17 KB,
image/png
|
Details |
- 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.
Updated•5 months ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Comment 1•28 days ago
|
||
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:
- Open about:preferences#home
- Uncheck everything except Shortcuts (search, stories, and widgets off)
- 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 astop-sites-onlyto the.container nova-enabledelement. - 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.
| Assignee | ||
Comment 2•6 days ago
|
||
Updated•6 days ago
|
Comment 4•11 hours ago
|
||
| bugherder | ||
Description
•