Skip to content

4149: Improve back navigation from the regions page#4184

Open
bahaaTuffaha wants to merge 2 commits into
mainfrom
4149-Improve-back-navigation-from-regions-page
Open

4149: Improve back navigation from the regions page#4184
bahaaTuffaha wants to merge 2 commits into
mainfrom
4149-Improve-back-navigation-from-regions-page

Conversation

@bahaaTuffaha

Copy link
Copy Markdown
Contributor

Short Description

Add a visible "Back to content" action on the region selection page (mobile only).

This would provide users with a clear recovery path when they unintentionally open the region selection flow and help them return to the page they were previously reading.

Proposed Changes

  • Created new component just for BackToContentButton.
  • window.history.state?.idx reads React Router's current position in the browser history stack.
  • edge-case: If you changed the language while at region page the last history page becomes the language change so to ignore this page: we save an entryIndex and subtract it from the history index so we remove any history added while we are still on the same page.
  • Created a small test for BackToContentButton.
  • While running jest tests on VsCode i encountered some weird issues on the IDE but it's passing the test on cli's yarn test (It assumes one Jest at the workspace root) so I added jest.virtualFolders to vsCode settings.

Side Effects

N/A

Checklist

Testing

  • Go to categories then click on the changeRegion button while testing on small screen.
  • Test the back button on large screens.
  • Test the back button after language change.
  • Test contrast mode.

Resolved Issues

Fixes: #4149


@bahaaTuffaha bahaaTuffaha added the Web Affects the web project label Jun 16, 2026

@steffenkleinle steffenkleinle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work! Works as expected :)

Comment thread web/src/components/BackToContentButton.tsx Outdated
Comment thread web/src/components/BackToContentButton.tsx Outdated
Comment thread web/src/components/BackToContentButton.tsx Outdated
Comment thread web/src/components/BackToContentButton.tsx Outdated
"shareQrCodeDescription": "Teile diese Seite einfach, indem du den QR-Code auf einem anderen Gerät scannst.",
"qrCode": "QR-Code"
"qrCode": "QR-Code",
"backToContent": "Zurück zum Inhalt"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ulyanahoy-cloud is Back to content/Zurück zum Inhalt necessary or would a simple Go Back/Zurück be enough? That would save us another translation :)

Comment thread web/src/components/__tests__/BackToRegionButton.spec.tsx
@bahaaTuffaha

Copy link
Copy Markdown
Contributor Author

@steffenkleinle I noticed that I need to run yarn ts:check sometimes to get the new translations working. did we change something in that regard ?

@steffenkleinle

Copy link
Copy Markdown
Member

@steffenkleinle I noticed that I need to run yarn ts:check sometimes to get the new translations working. did we change something in that regard ?

I think it is always necessary due to the switch to esm in #2404

@bahaaTuffaha

bahaaTuffaha commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@steffenkleinle I noticed that I need to run yarn ts:check sometimes to get the new translations working. did we change something in that regard ?

I think it is always necessary due to the switch to esm in #2404

How about we run it once after a yarn install or before yarn start?

@steffenkleinle

Copy link
Copy Markdown
Member

@steffenkleinle I noticed that I need to run yarn ts:check sometimes to get the new translations working. did we change something in that regard ?

I think it is always necessary due to the switch to esm in #2404

How about we run it once after a yarn install or before yarn start?

We could do that, but I think it would not fix your problem. You still need to run it manually after adjusting the translations.

@bahaaTuffaha bahaaTuffaha force-pushed the 4149-Improve-back-navigation-from-regions-page branch from 2edb0d5 to 316ce40 Compare June 18, 2026 12:36
@lunars97

Copy link
Copy Markdown
Contributor

@steffenkleinle I noticed that I need to run yarn ts:check sometimes to get the new translations working. did we change something in that regard ?

I think it is always necessary due to the switch to esm in #2404

How about we run it once after a yarn install or before yarn start?

We could do that, but I think it would not fix your problem. You still need to run it manually after adjusting the translations.

@andrew8er mentioned it before here #4093 (comment) and he said that he will implement this step as well in #4166 if I understood correctly

@andrew8er

Copy link
Copy Markdown

@andrew8er mentioned it before here #4093 (comment) and he said that he will implement this step as well in #4166 if I understood correctly

I'll see how I can implement that. What needs to be run for the translations?

@bahaaTuffaha

Copy link
Copy Markdown
Contributor Author

@andrew8er mentioned it before here #4093 (comment) and he said that he will implement this step as well in #4166 if I understood correctly

I'll see how I can implement that. What needs to be run for the translations?

yarn ts:check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Web Affects the web project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve navigation back from the region selection page

4 participants