Skip to content

bug: flip-rtl behavior isn't reactive when document dir changes #1196

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

Closed
3 tasks done
FranciskoNeves opened this issue Mar 13, 2023 · 4 comments · Fixed by #1210
Closed
3 tasks done

bug: flip-rtl behavior isn't reactive when document dir changes #1196

FranciskoNeves opened this issue Mar 13, 2023 · 4 comments · Fixed by #1210
Labels
type: bug A bug in the functionality of Ionicons

Comments

@FranciskoNeves
Copy link

Prerequisites

Ionic Framework Version

v6.x

Current Behavior

When I change the app to RTL, the ion-back-button arrow doesn't instantly changes to RTL, I need to change to another page to see the change.

Expected Behavior

Right after change to RTL, the ion-back-button arrow turns 180 degrees.

Steps to Reproduce

Navigate to a page with an ion-back-button, change document.documentElement.dir to 'rtl' and you will see that the arrow doesn't change

Code Reproduction URL

https://github.com/FranciskoNeves/IonBackButtonRTL

Ionic Info

Ionic:

Ionic CLI : 6.20.3 (C:\Users\Francisco.neves\AppData\Roaming\nvm\v16.13.0\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.6.0
@angular-devkit/build-angular : 15.1.1
@angular-devkit/schematics : 15.1.1
@angular/cli : 15.1.1
@ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 4.6.1
@capacitor/android : not installed
@capacitor/core : 4.6.1
@capacitor/ios : not installed

Utility:

cordova-res : 0.15.4
native-run : 1.7.1

System:

NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
npm : 8.1.0
OS : Windows 10

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage New issues label Mar 13, 2023
@averyjohnston averyjohnston self-assigned this Mar 14, 2023
@averyjohnston
Copy link
Contributor

Thank you for the issue. To shed some light on how this works, ion-back-button uses ion-icon internally, which has a property called flip-rtl. This says whether the icon should flip horizontally when RTL is enabled. Currently, this behavior is not reactive, meaning RTL status is only checked when the component is first loaded, such as when starting the app or loading a new page.

Can you give more details on your use case for changing to RTL mode dynamically like that?

@averyjohnston averyjohnston added the needs: reply Issues that need more information from the author label Mar 16, 2023
@averyjohnston averyjohnston removed their assignment Mar 16, 2023
@ionitron-bot ionitron-bot bot removed the triage New issues label Mar 16, 2023
@FranciskoNeves
Copy link
Author

Ok, that explains the behavior of the ion-back-button.

My use case is simple, it's a settings page were the user can change the language (Arab is one of the option) of the app by selecting from a list displayed with ion-select componet, and then go back to home page clicking the ion-back-button, like the reproduction app that I posted here.

@ionitron-bot ionitron-bot bot added triage New issues and removed needs: reply Issues that need more information from the author labels Mar 16, 2023
@averyjohnston
Copy link
Contributor

Thank you, that makes sense to me. I'm going to move this to the Ionicons repo since that's where the origin of the issue is, and highlight it with the team internally so we can move things forward.

@averyjohnston averyjohnston transferred this issue from ionic-team/ionic-framework Mar 16, 2023
@averyjohnston averyjohnston changed the title bug: Ion-back-button doesn't instantly changes to RTL bug: flip-rtl behavior isn't reactive when document dir changes Mar 16, 2023
@averyjohnston averyjohnston added the type: bug A bug in the functionality of Ionicons label Mar 16, 2023
@ionitron-bot ionitron-bot bot removed the triage New issues label Mar 16, 2023
@mapsandapps
Copy link
Contributor

Hi! Thanks for the report. Here's a dev build with a proposed fix if you'd like to test it:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A bug in the functionality of Ionicons
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants