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

HAI-1248 Fix document scroll position in forms #390

Merged
merged 2 commits into from
Oct 16, 2023

Conversation

markohaarni
Copy link
Contributor

@markohaarni markohaarni commented Oct 10, 2023

Description

Fixed problem where form page in hanke form and cable report application form would not be scrolled to top when entering the form or changing form page.

Made it so that window.scrollTo(0, 0) is called whenever URL pathname is changed so this actually fixes possible scroll position problems in each page change, not just forms.

Jira Issue: https://helsinkisolutionoffice.atlassian.net/browse/HAI-1248

Type of change

  • Bug fix
  • New feature
  • Other

Instructions for testing

  1. Navigate to hanke form so that page is scrolled a bit down
  2. Check that page is scrolled to top when entering form
  3. Scroll to bottom of form page and go to next page in form
  4. Check that page is scrolled to top
  5. Try changing to other form pages too and test this also in cable report application form

Checklist:

  • I have written new tests (if applicable)
  • I have ran the tests myself (if applicable)
  • I have made necessary changes to the documentation, link to confluence
    or other location:

Other relevant info

Please describe here if there is e.g. some requirements for this change or
other info that the tester/user needs to know.

Fixed problem where form page in hanke form and cable report
application form would not be scrolled to top when entering
the form or changing form page.

Made it so that window.scrollTo(0, 0) is called when
MultipageForm component is mounted and unmounted and
also when changing form page.
useScrollToTop hook and that scroll to top is done in each page
change instead of just forms.
@corvidian
Copy link
Contributor

corvidian commented Oct 13, 2023

This seems like a pretty heavy-handed solution. Are there no pages where we wouldn't want to scroll to the absolute top?

Like, this makes the page scroll to the top when changing the tabs on the hanke page? Edit: This was caused by my window being too large. There's no scrolling here with a smaller window.

@markohaarni
Copy link
Contributor Author

This seems like a pretty heavy-handed solution. Are there no pages where we wouldn't want to scroll to the absolute top?

Like, this makes the page scroll to the top when changing the tabs on the hanke page? Edit: This was caused by my window being too large. There's no scrolling here with a smaller window.

For me it seems like desired behaviour to scroll to top on each page change, but maybe this needs to be confirmed.

@markohaarni markohaarni merged commit 3c7d70c into dev Oct 16, 2023
1 check passed
@markohaarni markohaarni deleted the HAI-1248/fix-page-scroll-in-forms branch October 16, 2023 08:14
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