Skip to content

fix: adjust scroll margins for anonymous consent management banner and form elements of the register page#21343

Open
npapp-dev002 wants to merge 7 commits intodevelopfrom
fix/CXSPA-12260
Open

fix: adjust scroll margins for anonymous consent management banner and form elements of the register page#21343
npapp-dev002 wants to merge 7 commits intodevelopfrom
fix/CXSPA-12260

Conversation

@npapp-dev002
Copy link
Copy Markdown
Contributor

fix(register): scroll focused form fields into view above the anonymous consent banner

Problem

The cx-anonymous-consent-management-banner component renders as a position: fixed; bottom: 0 overlay at the bottom of the viewport. When a user navigates the registration form using the Tab key, the browser's native focus-scroll behaviour does not account for the fixed banner, causing focused form fields to be obscured behind it.

Solution

A pure CSS fix was applied using two complementary browser-native scroll properties:

  • scroll-padding-bottom on the html element — instructs the browser to reserve bottom clearance equal to the banner height whenever it auto-scrolls a focused element into view. Applied conditionally via :has() so it is only active when the banner is actually visible.
  • scroll-margin-bottom on register form groups and focusable elements — ensures each focusable element declares its own required bottom margin from the viewport edge, centering it in the visible area above the banner on Tab focus.

A shared SCSS variable ($cx-anonymous-consent-banner-height) was introduced to avoid magic numbers and keep all related offsets in sync.

Notes

  • No JavaScript changes — the fix is entirely CSS-based.
  • The $cx-anonymous-consent-banner-height variable uses rem units (instead of px) to respect the user's browser font-size settings, which aligns with the existing codebase conventions and improves accessibility.
  • The !default flag allows consuming applications or custom themes to override the value if needed.
  • The :has() selector ensures scroll-padding-bottom is only applied when the banner is rendered and visible, avoiding any side effects on other pages.

QA steps

  1. authorizationCodeFlowByDefault feature flag needs to be set to false in order to make the registration page visible.
  2. Click on Sign in / Registration and try to use Tab button to navigate between elements.
  3. They should be positioned in the center of the page after every Tab button press.

@npapp-dev002 npapp-dev002 requested review from a team as code owners April 7, 2026 15:43
@github-actions github-actions Bot marked this pull request as draft April 7, 2026 15:43
@npapp-dev002 npapp-dev002 marked this pull request as ready for review April 8, 2026 11:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions Bot marked this pull request as draft April 8, 2026 11:51
@npapp-dev002 npapp-dev002 marked this pull request as ready for review April 8, 2026 12:41
@cypress
Copy link
Copy Markdown

cypress Bot commented Apr 8, 2026

spartacus    Run #52837

Run Properties:  status check passed Passed #52837  •  git commit 15f2de7d0d ℹ️: Merge 85f88c1e1b8ef801e1b1a86306319d474af67b10 into 405b02b73d4de08ed403565ae6bc...
Project spartacus
Branch Review fix/CXSPA-12260
Run status status check passed Passed #52837
Run duration 04m 44s
Commit git commit 15f2de7d0d ℹ️: Merge 85f88c1e1b8ef801e1b1a86306319d474af67b10 into 405b02b73d4de08ed403565ae6bc...
Committer Norbert Papp
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 101
View all changes introduced in this branch ↗︎

Comment thread feature-libs/user/profile/styles/_register.scss
Comment thread projects/storefrontstyles/scss/cxbase/_variables.scss Outdated
@BenjaminEmiliani
Copy link
Copy Markdown
Member

Changes are working as expected, I have left two minor comments

@github-actions github-actions Bot marked this pull request as draft April 23, 2026 08:12
@npapp-dev002 npapp-dev002 marked this pull request as ready for review April 23, 2026 08:56
@github-actions
Copy link
Copy Markdown
Contributor

E2E Tests Failed ❌

📸 Download Screenshots


Commit: 15f2de7

@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions Bot marked this pull request as draft April 23, 2026 12:26
@npapp-dev002 npapp-dev002 marked this pull request as ready for review April 23, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants