Comments (7)
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.
I think closing on esc key and backdrop click can be optional. We can show confirmation when close buttons are clicked.
from baklava.
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.
Yes, this option could work.
from baklava.
🎉 This issue has been resolved in version 2.2.0-beta.2 🎉
The release is available on:
Your semantic-release bot 📦🚀
from baklava.
@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.
🎉 This issue has been resolved in version 2.2.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from baklava.
Related Issues (20)
- [BUG]: Baklava select input popover close event trigger problem HOT 2
- trendyol.design Website HOT 1
- [BUG]: border-top is not coming correctly in BlInput label animation HOT 3
- Enhancing SSR Compatibility HOT 1
- npm install @trendyol/baklava
- Add Custom CSS Properties for Border Radius, Style, and Color to bl-button HOT 4
- Change table row hover color
- [BUG]: <Border of single select clear button is missing> HOT 1
- [Feature Request]: <Textarea Custom Validation>
- [BUG]: Empty bl-select causes floating-ui to throw an error HOT 2
- [BUG]: False positives for notification UI tests on PRs
- [BUG]: Searchable select hides label HOT 2
- [Feature Request]: Select search should support international character set
- [BUG]: Select search isn't cleared on option select
- [BUG]: Storybook select input triggers storybook shortcuts
- [Feature Request]: <Adding Critical Dialog Variant to Dialog Component>
- [Feature Request]: Create ADRs folder per component
- [Component]: <Spinner Component>
- [BUG]: <Split Button seperated events>
- [BUG]: Disabled select option can be selected with enter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baklava.