Hacker News new | ask | show | jobs
by Akcium 1420 days ago
It's my article. I just got a traffic spike, so I noticed it's here.

I guess the person who posted it checked out the URL that I have, and previously I indeed called it something like stop using modals.

The thing is that they are really OVERused. And right now I'm working on a project where we have modals inside modals and sometime even popup as a third layer. I cannot influence these decisions, but it's TOO much.

5 comments

I even remember I made a tweet for fun https://twitter.com/vponamariov/status/1528758532182515714 when I started working on a project that had up to 3(!!) modals inside.

It's not only hard for users, it's hard for developers, when they have scroll issues, when they should update each other, when you should keep track of URL (what if user hits F5 or wants to share these...modal hell)

I personally also find it hard getting accessibility to work right. Depending on the modal and js library used to generate it, getting aria tags to work right always feels difficult.
the new-ish <dialog> tag with a <form method="dialog"><button>Close</button></form> inside, combined with styling the pseudo-element ::backdrop, comes very close to being javascript-less built-in solution for modals. you still need js to trigger opening the dialog though, but that can be as simple as document.querySelector('#dialog').showModal()

apparently <dialog>'s still needs some accessibility/interaction improvements to be a first-class solution, but it's getting there: https://nolanlawson.com/2022/06/14/dialogs-and-shadow-dom-ca...

> right now I'm working on a project where we have modals inside modals

I know this is just expressing my frustration into the void... but how does that even get past a professional review?

I've always been under the impression that best practices for modals is to never nest them, and/or never have multiples open at the same time because at that point you're effectively making a nesting doll UIX, or worse... creating a window manager in the browser.

Been seeing this happen more and more with the advent of the SPA - people jamming way too much functionality into modals because god forbid our users experience page navigation /s

The same is true of iOS - they are used almost by default in many apps without considering the consequences. It’s a context switch, and developers often forget that.
Who turned the Ubuntu save dialog into a full screen modal? Is there a way to fix it?

It's so painful that I might even get of my ass and contribute, but knowing open source, it's equally likely that this is a politics problem, not a code problem.

(The submitted title was "You Shouldn’t Use Modals" but we changed it to the article title, which is less baity, per https://news.ycombinator.com/newsguidelines.html)