ionic-team / ionic-team/ionic-framework

bug: Ionic Angular routerDirection not being reset to "auto"

Open
#21,161 2 comments 0 reactions 0 assignees View on GitHub
package: angular type: bug
Dominant language
TypeScript
Stars
52.7k
Forks
13.3k
Avg merge
1d 15h
Merged PRs (30d)
51

Description

# Bug Report

**Ionic version:**
[x] **5.0.7**

**Current behavior:**
Navigation to same route twice using `[routerLink]` with `routerDirection="root"` does not reload component (expected), but leaves changed `direction=root`.

**Expected behavior:**
When navigation was dismissed (not consumed by NavController) `direction` should be set back to `auto` (or not modified at all) as if it would be after the transition finished.

**Steps to reproduce:**
1. https://github.com/kamilchlebek/ionic-router-issue
2. `ionic serve`
3. Tap `go to sub page`
4. You'll see expected back button
5. Tap back button
6. Open side menu - tap "Page" (which links to already opened page)
7. Tap `go to sub page`
8. :x: there's no back button

**Other information:**

Same thing happens while using angular v9
Of course I know that I can update `direction` manually before using `router.navigate` but it took me a while to figure it out.

**Ionic info:**
```
Ionic:

Ionic CLI : 6.6.0
Ionic Framework : @ionic/angular 5.0.7
@angular-devkit/build-angular : 0.803.26
@angular-devkit/schematics : 8.3.26
@angular/cli : 8.3.26
@ionic/angular-toolkit : 2.2.0

Utility:

cordova-res : not installed
native-run : 1.0.0

System:

NodeJS : v12.16.1
npm : 6.13.4
OS : Linux 4.15
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction repository and run `ionic serve`, then follow the `[routerLink]` navigation using `routerDirection="root"` in the Ionic Angular router handling. Reproduce the side-menu navigation to an already-open page and confirm that a later sub-page navigation restores the expected back button by resetting the direction to `auto` when navigation is dismissed.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.