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

Modal navigation ignores the modal_style property #93

Open
leonvogt opened this issue Mar 2, 2025 · 1 comment
Open

Modal navigation ignores the modal_style property #93

leonvogt opened this issue Mar 2, 2025 · 1 comment

Comments

@leonvogt
Copy link
Contributor

leonvogt commented Mar 2, 2025

I've noticed that the current implementation of modal-to-modal navigation doesn't account for different modal_style properties.

Example Path Configuration for the Demo app:
"/one" should be opened in a medium modal
"/two" should be opened in a large modal

{ 
  "patterns": [
    "/one"
  ],
  "properties": {
    "context": "modal",

    "modal_style": "medium"
  }
},
{ 
  "patterns": [
    "/two"
  ],
  "properties": {
    "context": "modal",
    "modal_style": "large"
  }
}

When navigating from /one to /two, the modal opens in a medium style, even though /two should be displayed in a large modal.
I'm not sure if this is the expected behavior—I was just surprised when I encountered it.

My use-case:

  • I have a modal that contains an action menu, similar to the MenuComponent, just with HTML
  • Some of the links in the menu should open a new modal, preferably in a larger style.

Notes:

  • The order of modal_style doesn't seem to matter (large → medium | medium → large | medium → full etc.)
  • On Android, where only two modal styles are available by default, the correct modal style is applied.

Example Path Configuration for the Android app:

{
  "patterns": [
    "/one"
  ],
  "properties": {
    "context": "modal",
    "uri": "hotwire://fragment/web/modal/sheet",
    "pull_to_refresh_enabled": false
  }
},
{
  "patterns": [
    "/two"
  ],
  "properties": {
    "context": "modal",
    "uri": "hotwire://fragment/web/modal",
    "pull_to_refresh_enabled": false
  }
},

Happy to submit a PR if you think this is a desirable behaviour.

@joemasilotti
Copy link
Member

I think that modal-to-modal navigation should respect the style. Assuming this is possible, then yes, we would happily accept a PR fixing the behavior.

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

No branches or pull requests

2 participants