Giter Club home page Giter Club logo

Comments (7)

muratcorlu avatar muratcorlu commented on May 24, 2024

I think there can be several considerations on how to handle forms inside dialog. Currently user can close dialog by clicking dialog’s close button, to backdrop or to the close action button defined by the developer. Plus, dialogs can be dismissed by pressing Esc key. All of those can be done “accidentally”. To avoid this:

  • We may consider a tight integration about using form inside dialog, and then dialog can check if the form inside is edited before closing itself, and show a confirmation message.
  • We may consider giving option to create “non-dismissable” dialogs that will not show close button, will not be close by clicking backdrop or Esc key. In this case this dialog can only be closed via dialog actions that defined (and handled) by the developer. Showing a confirmation message before closing the form when form is not saved yet, should be also done by the developer. For the best user experience, we should encourage developers to not miss showing confirmation message to the user, I believe.

Another consideration would be the other use cases of having “non-dismissable” dialogs other than just form content. Maybe confirmation dialogs that we really want user to pick one of the actions, could be another reason to have this option.

So both features, handling form inside dialog automatically and having “non-dimissible” dialog option can be considered together.

I would like to hear opinions about this.

from baklava.

serkancetintas avatar serkancetintas commented on May 24, 2024

I think closing on esc key and backdrop click can be optional. We can show confirmation when close buttons are clicked.

from baklava.

muratcorlu avatar muratcorlu commented on May 24, 2024

Another option would be to have a new event that can be defaultPrevented to block closing dialog in specific flows defined by developer. Like this: https://shoelace.style/components/dialog?id=preventing-the-dialog-from-closing

from baklava.

serkancetintas avatar serkancetintas commented on May 24, 2024

Yes, this option could work.

from baklava.

github-actions avatar github-actions commented on May 24, 2024

🎉 This issue has been resolved in version 2.2.0-beta.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

from baklava.

muratcorlu avatar muratcorlu commented on May 24, 2024

@serkancetintas with version 2.2.0-beta.2, now you can track if your form has some changes and block closing dialog if it's not saved yet. Like:

document.querySelector('bl-dialog').addEventListener('bl-dialog-request-close', (event) => {
  if (formIsDirty) {
    event.preventDefault();
    showWarningMessage();
  }
});

from baklava.

github-actions avatar github-actions commented on May 24, 2024

🎉 This issue has been resolved in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from baklava.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.