Skip to content

Conversation

@WoodingMP
Copy link
Contributor

We've got a current issue in relation to the RouterView component and its automatic handling of backtracking through app history.

In our app, we have a navigation bar that sits at the top level alongside the RouterView component. In our nav we've got multiple routes that we move between, and we want to be able to refocus the nav by pressing back from any of those routes.

The issue is that when using this.parent.$focus(e) we want to call the back handler in our app, but instead it is getting stuck at the RouterView, at which point it automatically navigates to the last page in history.

As a potential fix for this, we could have an optional prop for the RouterView component navigateHistory that when set to false disables the automatic backtracking, and instead passes any back press up to the app, so that it can be handled without triggering automatic navigation.

Example of how to use:
<RouterView navigateHistory="false" />

@github-actions
Copy link

Linting errors found

These linting errors must be fixed before this PR can be merged:

src/components/RouterView.js
  Line 53:14: Replace `key:·'navigateHistory',·default:·true` with `·key:·'navigateHistory',·default:·true·` (prettier/prettier)

Run npm run lint:fix to automatically fix some of these issues.

@github-actions
Copy link

Test Results: ✅ PASSED

Run at: 2025-08-19T10:56:13.046Z

Summary:
passed: 665 failed: 0 of 665 tests

@WoodingMP WoodingMP force-pushed the feat/optional-history-backtrack branch from 827c25e to adbe5d1 Compare August 19, 2025 10:57
@github-actions
Copy link

Test Results: ✅ PASSED

Run at: 2025-08-19T10:58:13.249Z

Summary:
passed: 665 failed: 0 of 665 tests

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.

1 participant