Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

fix: remove sidebar scroll behaviour #3383

Merged
merged 2 commits into from
Jan 31, 2022
Merged

fix: remove sidebar scroll behaviour #3383

merged 2 commits into from
Jan 31, 2022

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Jan 28, 2022

What it solves

Auto-scroll in long sidebars.

How this PR fixes it

The scrollbar no longer scrolls to the Safe when opening the sidebar. Instead, positioning the Safe in the middle of the sidebar.

How to test it

  • Open a Safe on a network with multiple Safes.
  • Ensure that the sidebar has a scrollbar (requiring scrolling to position the loaded Safe in the middle of the sidebar).
  • Close and open the sidebar, observing that no scrolling occurs. The sidebar opens with the Safe in the middle of the list (if it was either in the viewport before or out of view).

Screenshot

scroll

@iamacook iamacook self-assigned this Jan 28, 2022
@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@@ -85,7 +85,7 @@ const SafeListItem = ({

useEffect(() => {
if (isCurrentSafe && shouldScrollToSafe) {
safeRef?.current?.scrollIntoView({ behavior: 'smooth' })
safeRef?.current?.scrollIntoView()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can still pass block: 'center' for better positioning.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But is it not then at the top of the page?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block: 'center' is supposed to keep the viewport where it is if the item is already visible.
The default is block: start, and it will always scroll the page so that the item is on top of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to experiment though, I'm not 100% sure it will be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can happily change it. What are your thoughts @liliiaorlenko? Open the sidebar so the currently open Safe is at the top of the list or in the middle?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think In a middle would be the best (to not mess with the order?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will alter it now. (It doesn't change the order @liliiaorlenko, just the scroll position)

@github-actions
Copy link

github-actions bot commented Jan 28, 2022

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@github-actions
Copy link

Deployment links

🟠 Rinkeby Mainnet 🟣 Polygon 🟡 BSC Arbitrum 🟢 Gnosis Chain

@coveralls
Copy link

coveralls commented Jan 28, 2022

Pull Request Test Coverage Report for Build 1771964391

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 33.632%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/SafeListSidebar/SafeList/SafeListItem.tsx 0 1 0.0%
Totals Coverage Status
Change from base Build 1760720190: 0.0%
Covered Lines: 3187
Relevant Lines: 8484

💛 - Coveralls

@github-actions
Copy link

github-actions bot commented Jan 28, 2022

E2E Tests Failed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1771991937

Failed tests:

  • ❌ Read-only transaction creation and review Read-only transaction creation and review

Copy link
Member

@usame-algan usame-algan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@francovenica
Copy link
Contributor

Looks good to me.
The scrolling is not there anymore, it just shows the safe right away.
It works with both, the safe saved in the AB or the safes in the "Safes owned" list

@iamacook iamacook merged commit b66a905 into dev Jan 31, 2022
@iamacook iamacook deleted the remove-scroll-behaviour branch January 31, 2022 16:15
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants