Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit height of page content so that app bar and nav bar stays visible when scrolling #1121

Merged

Conversation

kennethnym
Copy link
Member

@kennethnym kennethnym commented Jul 7, 2022

Description

This PR limits the height of PageContainer so that the app bar and the footer is still visible when the page is scrolling.

Demo

This clip shows the new scroll behavior:

SciGateway.and.10.more.pages.-.Work.-.Microsoft.Edge.2022-07-07.15-39-55.mp4

Testing instructions

  • Review code
  • Check Actions build
  • Review changes to test coverage

Agile board tracking

connect to #996

Closes #996

@kennethnym kennethnym added the enhancement New feature or request label Jul 7, 2022
@kennethnym kennethnym linked an issue Jul 7, 2022 that may be closed by this pull request
1 task
@codecov
Copy link

codecov bot commented Jul 7, 2022

Codecov Report

Merging #1121 (1dc3be6) into develop (ea067ff) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #1121      +/-   ##
===========================================
- Coverage    97.66%   97.66%   -0.01%     
===========================================
  Files           42       42              
  Lines         1586     1585       -1     
  Branches       433      432       -1     
===========================================
- Hits          1549     1548       -1     
  Misses          34       34              
  Partials         3        3              
Impacted Files Coverage Δ
src/routing/routing.component.tsx 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea067ff...1dc3be6. Read the comment docs.

@kennethnym kennethnym changed the title Limit height of help & a11y page so that the navigation is still visible Limit height of page content so that app bar and nav bar stays visible when scrolling Jul 7, 2022
@louise-davies louise-davies requested review from louise-davies and sam-glendenning and removed request for louise-davies July 28, 2022 13:13
Copy link
Contributor

@sam-glendenning sam-glendenning left a comment

Choose a reason for hiding this comment

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

UI-wise it looks good but as Louise said we still have an extra vertical scroll bar present in table view. This mostly affects Dataview from what I can see but I had a look elsewhere and saw maybe a couple of other areas that could maybe be improved too.

For example, on the admin download table, we have an extra scroll bar that we probably don't need and this is because the table element is surrounded by what looks to be a Paper component. I removed it and it got rid of the problem but also caused the whole section to be moved too far up and left, like so:

image

Have a play around with it and see if you can get it lining up nicely, I think it just needs some padding somewhere.

Similarly, I noticed the same problem on the downloadTab component in DataGateway Download which I think might be caused by this? So if you fancy having a go at that one too, that would be cool, would just require a PR on DataGateway repo.

src/routing/routing.component.test.tsx Outdated Show resolved Hide resolved
@kennethnym
Copy link
Member Author

Thank you for the review! I'll look into the scroll bar issue.

Comment on lines +123 to +125
<ThemeProvider theme={theme}>
<Routing />
</ThemeProvider>
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, one last change! Adding the ThemeProvider to the mounted wrapper has resulted in some massive additions to the snapshots that we just don't need. If you take it out from all the mounted wrappers in this file, you should get some more manageable snapshots. Once it's done, compare the new snapshots to what is currently on develop branch and as long as they look fairly similar in size, they're probably good to go!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I just realised. The ThemeProvider was what I initially told you to change. And now I realise that it's not even needed. Really sorry! I owe you one for this 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries! I didn't know it wasn't needed. I thought the Routing component would need it but turns out it doesn't. I don't think it should be removed though as we will have to rewrite it in @testing-library in the future which will actually require ThemeProvider since it renders the entire component out, and all the styling obviously requires the theme object to be in context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, if we remove it, we can more easily test the snapshot is correct during the migration to testing-library, plus just leaving the import by itself will make the linter complain. But that's just my opinion

@sam-glendenning
Copy link
Contributor

Also I think something might have gone wrong with the table in dataview... the bottom has been cut off

image

@kennethnym
Copy link
Member Author

I think it is due to a slight miscalculation of height in datagateway-dataview. I played around with the number and I found that replacing calc(100vh - 180px - 36px - 1px - ${linearProgressHeight} - ${breadcrumbHeight}) with calc(100vh - 152px -36px - 1px - ${linearProgressHeight} - ${breadcrumbHeight}) makes the container fit perfectly, although I don't really know why it is specifically 152px...

@sam-glendenning
Copy link
Contributor

I thought it could be something like that. Try the solution on a bunch of pages before submitting it, just to make sure it doesn't accidentally break something else!

@kennethnym
Copy link
Member Author

kennethnym commented Aug 1, 2022

The calculation is only for datagateway-dataview's table (specifically this line), so it shouldn't affect other pages, but I viewed other pages normally and in the responsive tool and couldn't produce any regression.

Copy link
Contributor

@sam-glendenning sam-glendenning left a comment

Choose a reason for hiding this comment

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

Tested this with ral-facilities/datagateway#1378 and it works well!

We do now have a snapshot that's bigger than it's worth but as long as we put a pin in it to remember to reduce it when we refactor tests, it can stay for now

@kennethnym
Copy link
Member Author

It should become smaller as we slowly migrate to @testing-library because instead of snapshotting the theme object, it snapshots the actual HTML output as if it were in a browser.

@kennethnym kennethnym merged commit 30d01c6 into develop Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scrolling for Help and Accessibility statement pages
2 participants