nbgl: align review-light final page vertical centering with reviews#1540
Draft
blucet-ledger wants to merge 1 commit intoLedgerHQ:masterfrom
Draft
nbgl: align review-light final page vertical centering with reviews#1540blucet-ledger wants to merge 1 commit intoLedgerHQ:masterfrom
blucet-ledger wants to merge 1 commit intoLedgerHQ:masterfrom
Conversation
In addContent() (lib_nbgl/src/nbgl_page.c), every content type that places content from the top of the main container inserts an empty top spacer of SMALL_CENTERING_HEADER when no real header is present (CENTERED_INFO, EXTENDED_CENTER, TAG_VALUE_LIST, TAG_VALUE_DETAILS, TAG_VALUE_CONFIRM) - except INFO_BUTTON. The empty header (a) shifts the main container's top down by SMALL_CENTERING_HEADER and (b) shrinks its height by the same amount; for a CENTER-aligned child the net effect is to move it down by SMALL_CENTERING_HEADER / 2 px. As a result, the final confirmation page of nbgl_useCaseReviewLight rendered its centered pictogram + title ~16/20/12 px (Stax/Flex/Apex) higher than the review's first page (EXTENDED_CENTER), producing a visible discontinuity. Apply the same `if (!headerAdded) addEmptyHeader(layout, SMALL_CENTERING_HEADER);` guard to the INFO_BUTTON case so the first and final pages of a review-light flow share the same vertical layout. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1540 +/- ##
=======================================
Coverage 91.87% 91.87%
=======================================
Files 39 39
Lines 4653 4653
Branches 584 584
=======================================
Hits 4275 4275
Misses 266 266
Partials 112 112
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The final confirmation page of
nbgl_useCaseReviewLight(the page with the centered pictogram, "Confirm change?" /finishTitle, and the "Approve" black button) renders its centered icon + title approximately 16 / 20 / 12 px (Stax / Flex / Apex) higher than the review's first page and the rest of the flow, producing a visible discontinuity.Root cause
In
addContent()(lib_nbgl/src/nbgl_page.c), every content type that places content from the top of the main container inserts an empty top spacer ofSMALL_CENTERING_HEADERwhen no real header is present:CENTERED_INFOEXTENDED_CENTER— used for the review first pageTAG_VALUE_LISTTAG_VALUE_DETAILSTAG_VALUE_CONFIRM…except
INFO_BUTTON(andINFO_LONG_PRESS), which callnbgl_layoutAddContentCenterdirectly.The empty header has two coupled effects (
lib_nbgl/src/nbgl_layout.c:2896-2897): it shifts the main container's top down bySMALL_CENTERING_HEADERand shrinks its height by the same amount. For aCENTER-aligned child, the net effect is a downward move ofSMALL_CENTERING_HEADER / 2px. Without the spacer, theINFO_BUTTONblock ends up that much higher than every other page.Fix
Apply the same
if (!headerAdded) addEmptyHeader(layout, SMALL_CENTERING_HEADER);guard to theINFO_BUTTONcase so review-light's first and final pages share the same vertical layout.Affected public APIs
Sole users of the
INFO_BUTTONcontent type viaaddContent():nbgl_useCaseReviewLightnbgl_useCaseStaticReviewLight(deprecated)nbgl_useCaseActionINFO_LONG_PRESS(regular-review hold-to-sign final page) has the same asymmetry but is intentionally left out of this PR to keep scope minimal — happy to address it in a follow-up after visual verification across review flows.Visual change
On affected pages the centered icon + title shifts down by:
Other pages are unchanged.
Changes include
Additional comments
Minimal repro:
~/dev/app-nbgl-testscallsnbgl_useCaseReviewLightdirectly. Speculos before/after screenshots on Stax / Flex / Apex are the cleanest visual confirmation.