feat: Add Confirm ScrollToBottom component and update ConfirmPage
Description
Fixes: https://github.com/MetaMask/metamask-extension/issues/21285
Creates a ScrollToBottom component for the ConfirmPage which reuses the ScrollToBottom hook
Features:
- button only appears when the content is scrollable
- button click scrolls to the bottom
- button disappears when the user reaches the bottom
- sets currentConfirmation.isScrollToBottomNeeded to be shared through the redux store
ScrollToBottom hook Updates:
- add hasScrolledToBottom state while keeping isScrolledToBottom state allowing us to integrate the ability for the button to reappear after it disappears
- add smooth scrolling
Additional Updates:
- updates ConfirmPage to use the multichain Page component
- new
isScrollToBottomNeededprop on Confirmation type - updates confirm reducer to accept object with only updated props rather than full CurrentConfirmation object
For confirmation page only, overrides ButtonIcon hover styles as hover styles have an outstanding issue with our Design System components. Currently, the hover style incorporates the opacity with the color which causes issues. (ref: https://github.com/MetaMask/metamask-extension/pull/19976/files)
[!NOTE]
no behavioral changes have been made to the other instances that use the ScrollToBottom hook except they will not use smooth scroll rather than instant scroll
Manual testing steps
- open storybook
yarn storybook - see http://localhost:6006/?path=/docs/components-app-confirm-scrolltobottom--docs
Screenshots/Recordings
https://github.com/MetaMask/metamask-extension/assets/20778143/9574cc8b-e9cb-4c26-a7d4-cd9f86dfd72c
Pre-merge author checklist
- [ ] I’ve followed MetaMask Coding Standards.
- [ ] I've clearly explained what problem this PR is solving and how it is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using JSDoc format if applicable
- [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
- [ ] I’ve properly set the pull request status:
- [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft".
Pre-merge reviewer checklist
- [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.
Codecov Report
Attention: Patch coverage is 85.00000% with 3 lines in your changes are missing coverage. Please review.
Project coverage is 68.73%. Comparing base (
6e397d0) to head (3eadb3e). Report is 2 commits behind head on develop.
:exclamation: Current head 3eadb3e differs from pull request most recent head cb799fc. Consider uploading reports for the commit cb799fc to get more accurate results
| Files | Patch % | Lines |
|---|---|---|
| ui/hooks/useScrollRequired.js | 66.67% | 2 Missing :warning: |
| ui/ducks/confirm/confirm.ts | 66.67% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #22349 +/- ##
===========================================
+ Coverage 68.72% 68.73% +0.01%
===========================================
Files 1124 1125 +1
Lines 43606 43621 +15
Branches 11669 11674 +5
===========================================
+ Hits 29967 29981 +14
- Misses 13639 13640 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [1e75af6]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1262 ± 118 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 89 | 302 | 192 | 82 | 40 |
| domContentLoaded | 8 | 205 | 82 | 80 | 38 | ||
| load | 894 | 1739 | 1262 | 246 | 118 | ||
| domInteractive | 8 | 205 | 82 | 80 | 38 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 88 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [c396e97]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (768 ± 34 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 88 | 138 | 107 | 13 | 6 |
| domContentLoaded | 9 | 29 | 14 | 5 | 2 | ||
| load | 693 | 931 | 768 | 71 | 34 | ||
| domInteractive | 9 | 29 | 14 | 5 | 2 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 88 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [996fd9d]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (787 ± 33 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 92 | 155 | 113 | 13 | 6 |
| domContentLoaded | 9 | 54 | 19 | 11 | 5 | ||
| load | 698 | 981 | 787 | 68 | 33 | ||
| domInteractive | 9 | 54 | 19 | 11 | 5 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 88 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [0cc3610]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (831 ± 30 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 103 | 174 | 130 | 22 | 10 |
| domContentLoaded | 10 | 51 | 23 | 13 | 6 | ||
| load | 757 | 961 | 831 | 61 | 30 | ||
| domInteractive | 10 | 51 | 23 | 13 | 6 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 88 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [955a8e8]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1037 ± 113 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 92 | 360 | 147 | 57 | 28 |
| domContentLoaded | 10 | 251 | 39 | 51 | 25 | ||
| load | 771 | 1893 | 1037 | 235 | 113 | ||
| domInteractive | 10 | 251 | 39 | 51 | 25 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 128 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [c9eb5f3]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (818 ± 35 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 80 | 135 | 102 | 17 | 8 |
| domContentLoaded | 9 | 35 | 16 | 6 | 3 | ||
| load | 709 | 967 | 818 | 73 | 35 | ||
| domInteractive | 9 | 35 | 16 | 6 | 3 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 128 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [f18ec97]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1001 ± 25 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 108 | 267 | 198 | 34 | 16 |
| domContentLoaded | 10 | 110 | 49 | 29 | 14 | ||
| load | 894 | 1123 | 1001 | 53 | 25 | ||
| domInteractive | 10 | 110 | 49 | 29 | 14 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 128 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [9de9905]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1081 ± 37 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 122 | 379 | 178 | 58 | 28 |
| domContentLoaded | 9 | 95 | 28 | 25 | 12 | ||
| load | 893 | 1234 | 1081 | 76 | 37 | ||
| domInteractive | 9 | 95 | 28 | 25 | 12 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 128 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [3eadb3e]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1447 ± 439 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 77 | 171 | 122 | 23 | 11 |
| domContentLoaded | 10 | 60 | 28 | 13 | 6 | ||
| load | 52 | 2720 | 1447 | 914 | 439 | ||
| domInteractive | 10 | 60 | 28 | 13 | 6 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 128 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [b623278]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (700 ± 398 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 71 | 349 | 131 | 64 | 31 |
| domContentLoaded | 11 | 76 | 31 | 20 | 10 | ||
| load | 66 | 2025 | 700 | 829 | 398 | ||
| domInteractive | 11 | 76 | 31 | 20 | 10 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 374 Bytes (0.00%)
- common: 0 Bytes (0.00%)