News for hackers. Stuff that matters.
Re:How it feels to learn JavaScript in 2017 by seanwilson on Sunday August 27, 2017 @01:11AM (#15109238)
> 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.

Re:How it feels to learn JavaScript in 2017 by cknoxrun on Sunday August 27, 2017 @10:05AM (#15110845)
Or, perhaps instead of a library, use the built in browser confirmation dialog?
Re:How it feels to learn JavaScript in 2017 by seanwilson on Sunday August 27, 2017 @10:56AM (#15111032)
That's not an option for anything but maybe enterprise apps because the dialog styling is just too ugly usually.
Re:How it feels to learn JavaScript in 2017 by gkya on Sunday August 27, 2017 @10:31PM (#15114072)
This is completely subjective.
Re:How it feels to learn JavaScript in 2017 by Can_Not on Monday August 28, 2017 @12:08PM (#15117576)
The native dialogs are defacto bad user experiences. Previous discussion: https://news.ycombinator.com/item?id=11745127
Re:How it feels to learn JavaScript in 2017 by simion314 on Sunday August 27, 2017 @12:05PM (#15111306)
You may need modal that contain complex html not only text, imagine a modal that shows a video and a do not show again checkbox.