Skip to content

fix(#9732): infinite loop on privacy policy page#9733

Merged
dianabarsan merged 7 commits intomedic:masterfrom
paulpascal:9732-navigation-issue-privacy-page
Jan 29, 2025
Merged

fix(#9732): infinite loop on privacy policy page#9733
dianabarsan merged 7 commits intomedic:masterfrom
paulpascal:9732-navigation-issue-privacy-page

Conversation

@paulpascal
Copy link
Copy Markdown
Contributor

@paulpascal paulpascal commented Jan 8, 2025

Description

Fixes Navigation Issue with Back Buttons on Privacy Policy Page

This fix addresses the navigation issue observed on the Privacy Policy page where clicking the bottom back button first leads to an infinite loop between the top and bottom of the page. Specifically:

  • When accessing the Privacy Policy from the login page, clicking the bottom back button first would scroll the page to the top.
  • The top back button, when clicked after this, would return the user to the bottom, and vice versa, creating an endless loop.

Changes Made:

  • Adjusted the event listeners to ensure that the back button consistently takes the user back to the login page, without causing an infinite loop between the top and bottom of the Privacy Policy page.
  • The top back button now returns to the login page as expected when clicked, regardless of whether the bottom or top button is clicked first.

Related Issue: #9732

Code review checklist

  • UI/UX backwards compatible: Test it works for the new design (enabled by default). And test it works in the old design, enable can_view_old_navigation permission to see the old design.
  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or e2e where appropriate
  • Internationalised: All user facing text
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@dianabarsan dianabarsan self-requested a review January 10, 2025 05:07
Copy link
Copy Markdown
Member

@dianabarsan dianabarsan left a comment

Choose a reason for hiding this comment

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

Very cool! Thanks for this :)
I think it would be super useful to add an e2e test for the login privacy policy, including the action of this back button. We have a bunch of e2e tests that cover privacy policies, but none target this page:

Additionally, it will be useful to test this code automatically in our minimum browser (since you're switching to arrow functions) - which will happen automatically if you add an e2e test in that file.

Thanks again! Nice work!

@paulpascal
Copy link
Copy Markdown
Contributor Author

Thanks @dianabarsan for your feedback :) - I will make the right adjustments

@paulpascal paulpascal force-pushed the 9732-navigation-issue-privacy-page branch from 2afbb8d to ccc6dd2 Compare January 28, 2025 16:11
Copy link
Copy Markdown
Member

@dianabarsan dianabarsan left a comment

Choose a reason for hiding this comment

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

Excellent work!!! Thank you for taking the time to add a comprehensive e2e test and delivering code at the highest quality.

Am I free to merge this as is?

@paulpascal
Copy link
Copy Markdown
Contributor Author

paulpascal commented Jan 29, 2025

Thank you so much! 😊 Really appreciate the kind words and the review!

Happy to contribute - Yes, you’re absolutely free to merge it as is. <3

@dianabarsan dianabarsan merged commit 8e6ed11 into medic:master Jan 29, 2025
ShaunKrog pushed a commit to ShaunKrog/cht-core that referenced this pull request May 15, 2025
Fixes Navigation Issue with Back Buttons on Privacy Policy Page

This fix addresses the navigation issue observed on the Privacy Policy page where clicking the bottom back button first leads to an infinite loop between the top and bottom of the page. Specifically:

When accessing the Privacy Policy from the login page, clicking the bottom back button first would scroll the page to the top.
The top back button, when clicked after this, would return the user to the bottom, and vice versa, creating an endless loop.
Changes Made:

Adjusted the event listeners to ensure that the back button consistently takes the user back to the login page, without causing an infinite loop between the top and bottom of the Privacy Policy page.
The top back button now returns to the login page as expected when clicked, regardless of whether the bottom or top button is clicked first.

medic#9732
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