3 ms·
> Recently picked up a story that was adding a simple confirmation modal to a page: "Alert" text in the top, body with some warning text, and a yes/no button.
by seanwilson 9y ago
> Recently picked up a story that was adding a simple confirmation modal to a page: "Alert" text in the top, body with some warning text, and a yes/no button.
> By the time all was said and done the PR for this thing had 27 files in it.
Can you not just use a library for this and do it in a few lines...? I found Angular 2 verbose but I don't see how the above is common. I just did something similar in Vue today and it was about 4 lines to load the library and call it. You shouldn't be implementing modals yourself if you can avoid it.
- cknoxrun 9y agoOr, perhaps instead of a library, use the built in browser confirmation dialog?
- seanwilson 9y agoThat's not an option for anything but maybe enterprise apps because the dialog styling is just too ugly usually.
- gkya 9y agoThis is completely subjective.
- simion314 9y agoYou may need modal that contain complex html not only text, imagine a modal that shows a video and a do not show again checkbox.
- Can_Not 9y agoThe native dialogs are defacto bad user experiences. Previous discussion: https://news.ycombinator.com/item?id=11745127 https://news.ycombinator.com/item?id=11745127