Skip to content

Replace confirmation dialog with modal dialog.#3932

Merged
dgw merged 8 commits intoYOURLS:masterfrom
infinitail:replace-confirm
Dec 24, 2025
Merged

Replace confirmation dialog with modal dialog.#3932
dgw merged 8 commits intoYOURLS:masterfrom
infinitail:replace-confirm

Conversation

@infinitail
Copy link
Copy Markdown
Contributor

I replaced the use of JavaScript's confirm() with an HTML modal when deleting URL links in YOURLS.

@dgw
Copy link
Copy Markdown
Member

dgw commented Jun 11, 2025

Wouldn't it be simpler to use <dialog> with showModal()? You get a ::backdrop for free and don't have to set it up separately.

@infinitail
Copy link
Copy Markdown
Contributor Author

@dgw
As suggested, I changed it to use the element.

@ozh
Copy link
Copy Markdown
Member

ozh commented Sep 20, 2025

Hello, late into the discussion, sorry !

Currently :
image

This PR :
image

I'm all OK with the principle.

Is there any benefit in introducing a new modal.css instead of adding style to an existing CSS file ? Genuine question, I'm a CSS noob, but it seems to me that is another server request for just a few bytes of style. This would also remove the late <link rel="stylesheet" ... while all the others are grouped at the beginning of the file.

@ozh
Copy link
Copy Markdown
Member

ozh commented Sep 21, 2025

Maybe then we could easily expand on this modal window to deal with edits too ?

@ozh
Copy link
Copy Markdown
Member

ozh commented Sep 21, 2025

Thoughts, @dgw & @LeoColomb ?

@dgw
Copy link
Copy Markdown
Member

dgw commented Sep 22, 2025

Maybe then we could easily expand on this modal window to deal with edits too ?

I like that idea. Not to scope-creep this PR, of course, but in the future. Once we have one type of modal set up it makes the next one(s) easier. :)

Thoughts, @dgw & @LeoColomb ?

Agreed that the styles for this should just go in the existing style.css instead of a new file, especially if we're working toward the use of modals in more places as above.

It's not that big of a deal to fetch one extra CSS file with modern HTTP keepalive/pipelining/other fun stuff, and even less of one if caching is set up correctly. I could also see keeping it in a separate file for source clarity—but the <link> should go in the HEAD with other stylesheets in that case.

@LeoColomb
Copy link
Copy Markdown
Member

Thoughts, @dgw & @LeoColomb ?

Can't say better than @dgw, everything is said. 👍

@ozh
Copy link
Copy Markdown
Member

ozh commented Dec 13, 2025

Late concern : how does this play with accessibility ?

For example, could @lilmike test this PR and report ?

@lilmike
Copy link
Copy Markdown
Contributor

lilmike commented Dec 13, 2025

@ozh I tested this pr, it works fine for my screen reader. The dialogue hides the main portion of the page so I can only see the dialogue, which is a good thing, to be clear. The number of dialogues I see on websites that silently open up at the bottom of a page and I have no idea they're there until I start to wonder why clicking a button didn't do anything lol. Great job @infinitail

@ozh
Copy link
Copy Markdown
Member

ozh commented Dec 13, 2025

Thanks a lot for reporting @lilmike

ozh added 2 commits December 13, 2025 21:57
- more semantically correct HTML on the modal
- modal style tweaks
- jqueryfication of JS code and better handling of escape
@ozh
Copy link
Copy Markdown
Member

ozh commented Dec 13, 2025

Tweaks and improvements : more semantically correct HTML, better handling of JS events, handle long titles and URLs, no new CSS file.
Styling looks a bit better to me:

image

Unless someone has a new idea to express, this is good to go for me

@dgw dgw mentioned this pull request Dec 17, 2025
4 tasks
@dgw dgw self-assigned this Dec 17, 2025
Copy link
Copy Markdown
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, getting rid of ancient CSS technology (prefixed properties) 😀

@dgw dgw enabled auto-merge (squash) December 24, 2025 02:04
@dgw dgw merged commit 2872f99 into YOURLS:master Dec 24, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants