-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#2253] Add new modal with buttons #1009
Conversation
a25a71a
to
b6f430e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1009 +/- ##
===========================================
+ Coverage 95.01% 95.04% +0.02%
===========================================
Files 913 923 +10
Lines 32126 32343 +217
===========================================
+ Hits 30525 30740 +215
- Misses 1601 1603 +2 ☔ View full report in Codecov by Sentry. |
b344c94
to
465421b
Compare
f7ee948
to
bb9ddc4
Compare
a30dadf
to
b9c5131
Compare
bc2b3c0
to
c4fdcc0
Compare
6bd97b3
to
a011f09
Compare
a0af972
to
09f4ac8
Compare
2706199
to
c3d94fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments/questions
@@ -11,15 +13,21 @@ class Confirmation { | |||
if (!this.real_submit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
real_submit
is a strange name. Is there any other kind of submit
field? I know it's not your change, but perhaps consider changing this (unless it makes sense to you and I just misunderstand).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's not mine 🙂 but I understand why they chose this name: this name is often used when pop-up modals pop up after clicking something on the pages that just LOOKS like a Submit button, but actually isn't - and this modal warns the user about the data they are about to submit/delete - so not until they actually click the confirm button in the modal, does the "real" POST happen. So I think I'd like to keep this name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense!
One more thing I just noticed: when you hover over |
dc173e5
to
c9e49cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some notes for consideration.
{% spaceless %} | ||
{% button text=_("Sluiten") extra_classes="modal__button modal__close" primary=True %} | ||
{% endspaceless %} | ||
<button class="button modal__button modal__close button--primary button-icon--primary" type="button" aria-label="Sluit"><span class="inner-text">Sluiten </span></button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I note this change uses plain html while the one above it uses the template tag (but I have no opinion on it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one in the top above it is a standard cross icon that needs no visible text so can just use the template - but the one below is where things got complicated: the original Modal was overwriting all buttons entirely, instead of just overwriting their inner-most text, which meant it was impossible to give Modal submit-buttons etc. an icon; so that is one of the things this wall of a PR is tackling.
@@ -281,13 +281,12 @@ <h2 class="h2 title" id="profile-remove">{% trans "Profiel verwijderen" %}</h2>< | |||
{% trans "Hiermee worden alleen uw persoonlijke voorkeuren verwijderd. U krijgt dan bijvoorbeeld geen e-mail meer van ons over wijzigingen van uw lopende zaken. Uw persoonsgegevens en uw lopende zaken zelf worden hiermee niet verwijderd." %} | |||
</p> | |||
</div> | |||
{% render_form form=form method="POST" id="delete-form" extra_classes="confirm" spaceless=True data_confirm_title=_("Weet u zeker dat u uw account wilt verwijderen?") data_confirm_text=_("Hiermee worden alleen uw persoonlijke voorkeuren verwijderd. U krijgt dan bijvoorbeeld geen e-mail meer van ons over wijzigingen van uw lopende zaken. Uw persoonsgegevens en uw lopende zaken zelf worden hiermee niet verwijderd.") data_confirm_cancel=_("Nee, annuleren") data_confirm_default=_("Ja, verwijderen") %} | |||
{% render_form form=form method="POST" id="delete-form" extra_classes="confirm" spaceless=True data_confirm_title=_("Weet je zeker dat je jouw profiel wilt verwijderen?") data_confirm_text=_("Hiermee worden alleen uw persoonlijke voorkeuren verwijderd. U krijgt dan bijvoorbeeld geen e-mail meer van ons over wijzigingen van uw lopende zaken. Uw persoonsgegevens en uw lopende zaken zelf worden hiermee niet verwijderd.") data_confirm_cancel=_("Nee, annuleren") data_confirm_default=_("Ja, verwijderen") %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice attribute wall 🙈
setModalIcons(modalIcons) { | ||
// Whether the modal-buttons should have icons or not | ||
if (modalIcons) { | ||
this.node.classList.add('show-modal-icons') | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I note these functions only handle the truthy case (eg: don't remove/unset).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this had terrible and sad, lingering effects, so I changed that in the latest commit.
@pi-sigma I see, it's the buttons that received :focus where this was happening + I also removed the jumpy motion from the close-cross because I find it annoying + I needed to adjust for the situation where the "session" modals do not overwrite other modals properly (like when a user has not closed a modal, it doesn't get overwritten by the end-session warning). So that's what I changed in the new commit. |
|
||
&:hover { | ||
transform: translateY(-1px); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has a strange effect: the button not only moves to the top but is also contracted (it looses one pixel on the right).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is Firefox specific (Edge/Safari/Chrome do not have this). We also have this behaviour for ALL types of buttons that are hovered (like in the registration form etc.) so we'll promote this to a separate issue, since it's unrelated to the modals, so we can finalize the modals here :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case someone wants to see the new separate issue: https://taiga.maykinmedia.nl/project/open-inwoner/issue/2293
c9e49cd
to
9685a2b
Compare
issue: https://taiga.maykinmedia.nl/project/open-inwoner/task/2080issue: https://taiga.maykinmedia.nl/project/open-inwoner/task/2253
old issue number: 2080 // new issue number: 2253.
Design: https://www.figma.com/file/iKGhWhstaLIlFSaND2q7cE/OIP---Designs-(new)?type=design&node-id=253%3A5932&mode=design&t=Emt5JXGEXJyBppaB-1
Notes to reviewers:
The use of comments in the javascript is intentional ;-)
Main issue:
is that we need to be able to set more options for all the different types of modals (The Modal constructor acts a bit like an 'interface' here because it is called multiple times in different ways from the Master template):
(We have modals with or without top-right Close/Cross button and w./without icons,
also: some modals only use the Confirmation button, or only the Cancel button, and some of them both...
if buttons are not used, they need to be invisible or else they become 'Tabbable' = bad for accessibility).
Different types of modals can be found on:
http://localhost:8000/mijn-profiel/ (2X)
http://localhost:8000/mijn-profiel/contacts/ (remove contact)
http://localhost:8000/samenwerken/create/ (plan-preview)
http://localhost:8000/mijn-profiel/actions/ (delete actions)
+sitewide sessionmodal
+sitewide accessibilit header modal