Feature Description
The Key Metrics setup screen will be updated to place the Complete setup button near to the questions or in a sticky footer depending on the viewport height.
For reference, see the Key Metrics setup screen section in the design doc, and the Figma design.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
- For taller viewports which can accommodate the list of questions and CTA, the CTA should appear inline below the list of questions. The WordPress footer should be visible.
- For shorter viewports, the CTA footer should be sticky and overlay the WordPress footer.
- For the sticky footer, the CTA should be left-aligned with the questions.
Implementation Brief
See the implementation guide in the design doc.
Note: The changes can be seen in this diff, this branch can be used as a reference for implementation.
Test Coverage
- Run and update
KeyMetricsSetupApp tests and snapshots.
- Add tests for
AdaptiveFooterLayout
QA Brief
- Setup the SK and go upto key metrics setup screen.
- On the larger viewport, the CTA should appear inline below the list of questions as can be seen in the screenshot in PR description.
- On the smaller screen, where list of questions and CTA cannot be accommodated in the viewport, the CTA footer will be sticky and overlay the WordPress footer such that WordPress footer would not be visible. Please refer the screenshot in PR description.
- When the footer is sticky, the CTA should be left-aligned with the list of questions.
Changelog entry
- Use dynamic positioning for the Key Metric setup screen's "Complete setup" button, placing it in a sticky footer for shorter viewports.
Feature Description
The Key Metrics setup screen will be updated to place the Complete setup button near to the questions or in a sticky footer depending on the viewport height.
For reference, see the Key Metrics setup screen section in the design doc, and the Figma design.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
Implementation Brief
See the implementation guide in the design doc.
Note: The changes can be seen in this diff, this branch can be used as a reference for implementation.
In
assets/js/components/key-metrics-setup/AdaptiveFooterLayout.jsAdaptiveFooterLayoutcomponent to encapsulate adaptive CTA placement logic.useLayoutEffect,useRef, anduseStatefrom@wordpress/elementto manage viewport-fit calculation and element measurements.contentRefandfooterRefto measure content bottom and footer height.footerInline(defaultfalse) to toggle inline vs sticky footer mode.useLayoutEffect, compute:contentBottomfromcontentRef.current.getBoundingClientRect().bottom.footerHeightfromfooterRef.current.offsetHeight.contentBottom + footerHeight <= view.innerHeight.ownerDocument.defaultView(instead of globalwindow) to satisfy linting requirements.classNameinlineClassNamefooterClassNamefooterchildrenIn
assets/js/components/key-metrics-setup/KeyMetricsSetupApp.jsfooterfragment and pass it intoAdaptiveFooterLayoutvia thefooterprop.AdaptiveFooterLayoutchildren.className="googlesitekit-key-metrics-setup__content"inlineClassName="googlesitekit-key-metrics-setup__content--footer-inline"footerClassName="googlesitekit-user-input__footer googlesitekit-key-metrics-setup__footer"googlesitekit-key-metrics-setup__errorIn
assets/sass/components/key-metrics/_googlesitekit-key-metrics-setup-screen.scss.googlesitekit-key-metrics-setup__footer.googlesitekit-key-metrics-setup__content--footer-inline.googlesitekit-key-metrics-setup__errorpadding-left: 42pxpadding-left: 56pxfor(min-width: $bp-desktop).googlesitekit-key-metrics-setup__content--footer-inline), make CTA part of normal flow where it should appear below the list of questions for larger viewport.position: staticmargin: 32px 0 0background-color: transparentborder-top: noneleft,right,bottom,z-index)Test Coverage
KeyMetricsSetupApptests and snapshots.AdaptiveFooterLayoutQA Brief
Changelog entry