-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Improve the modal UX for the snapshot module #930
Conversation
Thanks for this, I'll have a look. As a general comment, could you please not upload gifs? Their constant animation is distracting, especially if it's not as fluid as this one. Screencasts are much better, you play them when you want. |
What about gif+screencast? |
0a59d4c
to
97bea70
Compare
97bea70
to
9d947d6
Compare
I'm not sure I like invisible inputs. But then that is what What do you think @insightsengineering/nest-core-dev? |
I'm not sure what you mean by "invisible inputs" but if you're referring to the bottom right |
I mean input widgets that have |
Should we make this as widget in teal.widget ? |
If you're proposing just the |
Introduces `nested_closeable_modal()` that can create nested popups inside an already existing popup. This will be used in the [teal PR #930](insightsengineering/teal#930) as per the discussion in the PR. Run the example to check it out: ```r devtools::load_all("teal.widgets") ui <- fluidPage( shinyjs::useShinyjs(), actionButton("show_1", "$('#modal_1').modal('show')"), nested_closeable_modal( "modal_1", modal_args = list( size = "l", title = "First Modal", easyClose = TRUE, footer = NULL ), tags$div( "This modal can be closed by running", tags$code("$('#modal_1').modal('hide')"), "in the JS console!", tags$br(), "Note that the second modal is placed right within this modal", tags$br(), "Alternatively, calling the", tags$code("removeModal()"), "will remove all the active modal popups", tags$br(), tags$br(), actionButton("show_2", "$('#modal_2').modal('show')"), actionButton("hide_1", "$('#modal_1').modal('hide')"), nested_closeable_modal( id = "modal_2", modal_args = list( size = "m", title = "Second Modal", footer = NULL, easyClose = TRUE ), div( "This modal can be closed by running", tags$code("$('#modal_1').modal('hide')"), "in the JS console!", "Note that removing the parent will remove the child. But, reopening will remember the open state of child", actionButton("hide_2", "$('#modal_2').modal('hide')"), actionButton("hide_all", "$('#modal_1').modal('hide')") ) ) ) ) ) server <- function(input, output) { observeEvent(input$show_1, { shinyjs::runjs("$('#modal_1').modal('show')") }) observeEvent(input$show_2, { shinyjs::runjs("$('#modal_2').modal('show')") }) observeEvent(c(input$hide_1, input$hide_all), { shinyjs::runjs("$('#modal_1').modal('hide')") }) observeEvent(input$hide_2, { shinyjs::runjs("$('#modal_2').modal('hide')") }) } shiny::shinyApp(ui, server) ``` --------- Signed-off-by: Vedha Viyash <[email protected]> Co-authored-by: Marcin <[email protected]> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
…napshot_upload@main # Conflicts: # inst/WORDLIST
While I like having them side by side, we shouldn't get too attached to that layout because in apps with many modules the mapping matrix will push the snapshots down anyway. See here. |
I would really like to hear some opinions on this. |
Ah, I see. In that case, I suppose this is bound to happen anyway. From a user's perspective, having a visible snapshot manager could make it more accessible. should we consider adding tabs in modal ? |
I don't like when the hidden elements persist to stay in the DOM forever. But, I'm not bothered by the hidden elements if they are removed when they are not needed which is the case with this. The nested popup is part of the main popup and will be completely removed once the main popup is removed. |
How about moving it to the top? and having a scroll to the table as suggested here |
Invisible inputs may have their advantages in specific scenarios, but personally, share both yours and vedha opinion on this. This is primarily due to the added complexity they introduce when managing visibility. Even when hidden, these inputs persist in the DOM, consuming resources and potentially causing latency in your application. |
@vedhav moving the snapshot manager table won't resolve this because a similar edge case exists there too. Users can encounter the same problem when adding multiple snapshots and pushing the filter table down. |
This discussion is branching into two. Let's keep the layout part in the relevant issue, shall we? |
While I like the UX improvement, I feel DX is severely deteriorated. Modals are created in the ui function and their handling (showing, hiding, updating) is done in the server. It could be just me because I like having everything in one place but it does feel disjointed. Also, there is no |
You're right, Removing the modal is an effect of being inside the modal which is the intended use of this "nested" modal. It's supposed to be nested inside a modal.
I would disagree that the modals are created in the UI. Shiny still creates them on the server side, so if you're disconnected from the server even the showModal/hideModal does not work, only the easyClose by clicking outside or pressing escape works because they are implemented on the JS side. |
OK, defined. |
# Conflicts: # DESCRIPTION # NEWS.md # R/init.R # R/module_snapshot_manager.R # man/snapshot_manager_module.Rd # tests/testthat/test-init.R
fcde60c
to
cc7399e
Compare
Code Coverage Summary
Diff against main
Results for commit: 218169b Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Problem:
It takes a small amount of time to close the modal and reopen it causing a bad UX, it would be nice if we could just overlay the secondary modal popups over the primary one creating a more intuitive UX for the user.
For testing I'm using the same app code mentioned in the PR #929
Changes:
custom_modal_dialog()
to create a custom modal dialog that can be placed along with other modal dialogs without issue, allowing these "custom modal dialogs" to be easily shown and hidden using JS.snapshot_name
causing thesnapshot_name
in the file upload dialog box to not have any value (now we have idsnew_snapshot_name
andnew_file_snapshot_name
).Please have a look at the GIF to see the new change. (~7MB might take a while to load)