Skip to content
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

classDiagram 'direction RL' state is maintained when removed #5624

Closed
Stemt opened this issue Jul 5, 2024 · 1 comment · Fixed by #5625
Closed

classDiagram 'direction RL' state is maintained when removed #5624

Stemt opened this issue Jul 5, 2024 · 1 comment · Fixed by #5625
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@Stemt
Copy link

Stemt commented Jul 5, 2024

Description

By default the direction of a classDiagram is Top-Down until one uses the 'direction RL' directive to change this to Right-Left.
I've however found that after removing this directive the classDiagram orientation stays Right-Left even if I use 'direction TD' (this is not officially mentioned in the documentation but would be intuitive and is a feature in other diagrams) .
This goes for both the mermaid live editor and my sphinx documentation.
In the live editor the diagram fixes itself after a page reload but I haven't been able find a fix for my sphinx documentation.

Steps to reproduce

  1. Create A classDiagram e.g.
classDiagram
    test1 -- test2

This diagram should be in the Top-Down orientation.

  1. Add 'direction RL' to the diagram
classDiagram
    direction RL
    test1 -- test2

The diagram should now be in the Right-Left orientation.

  1. Remove 'direction RL' from the diagram
classDiagram
    test1 -- test2

The diagram should now once again be in Top-Down orientation, but is not.

  1. Add 'direction TD' for good measure.
classDiagram
    direction TD
    test1 -- test2

It's now still in the Right-Left orientation.

Screenshots

Screenshot from 2024-07-05 11-57-33
Screenshot from 2024-07-05 11-57-47
Screenshot from 2024-07-05 11-58-00
Screenshot from 2024-07-05 11-58-09

Code Sample

No response

Setup

  • Mermaid version: v10.9.1 (live editor) & v10.9.0 (sphinx docs)
  • Browser and Version: [Chromium: 126.0.6478.126]

Suggested Solutions

  • implement 'direction TD' to force direction instead of relying on it being the default direction.

Additional Context

No response

@Stemt Stemt added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Jul 5, 2024
@sidharthv96
Copy link
Member

Thanks for raising the issue @Stemt!
The direction was not being cleared properly, so it's been fixed in #5625, and should be available in the next release.

github-merge-queue bot pushed a commit that referenced this issue Jul 7, 2024
fix(class): #5624 Reset direction to default in classDiagram
sidharthv96 added a commit that referenced this issue Jul 9, 2024
* develop: (80 commits)
  chore: update browsers list
  chore(deps): update eslint
  fix(class): #5624 Reset direction to default in classDiagram
  ci: upgrade to pnpm/action-setup@v4 to avoid CI failures
  chore(deps): update dependency eslint-plugin-unicorn to v54
  chore(deps): update dependency eslint-plugin-jsdoc to v48.5.0
  chore(deps): update all patch dependencies
  Sync docs folder
  Add Doctave to .cspell libraries
  Adds Doctave to list of integrations
  chore: update browsers list
  chore: Cleanup tsconfig
  chore: Fix lint
  Apply suggestions from code review
  chore: Remove extra words from cspell
  chore: Log granular rebuild times
  fix: Message wrap
  fix: Message wrap
  chore: Use `??` instead of `||`
  chore: Organise imports
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants