Skip to content
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

Modal close button doesn't work #33

Closed
VincentTam opened this issue Aug 13, 2019 · 3 comments

Comments

@VincentTam
Copy link
Collaborator

commented Aug 13, 2019

The line containsClass(body, show) ? closeModal() : false; is only executed once on page load. In that process, the conditional is evaluated to false, so the closeModal() is never called.

form ? handleForm(form) : false;
function closeModal() {
elem('.modal_close').addEventListener('click', function () {
deleteClass(body, show);
deleteClass(form, loading);
deleteClass(form, open);
deleteClass(button, toggled);
});
}
containsClass(body, show) ? closeModal() : false;
function showModal(title, message) {
elem('.modal_title').textContent = title;
elem('.modal_text').innerHTML = message;
pushClass(body, show);
}

I'm working on the project for nested comments, which would add about a hundred lines into the JS. Upon its release, the problem would be fixed. I'm leaving an issue here for record.

@VincentTam VincentTam added the bug label Aug 13, 2019

@VincentTam VincentTam self-assigned this Aug 13, 2019

@onweru

This comment has been minimized.

Copy link
Owner

commented Aug 13, 2019

True, I will refactor this. Have you been working on this file? I don't want to deal with merge conflicts hehe

@VincentTam

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 13, 2019

Have you been working on this file?

I've already found a solution: closeModal() contains the listener for the modal close button, so I've added this listener to the browser only when showModal(...msg) is invoked.

@VincentTam

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 14, 2019

Closed via #36.

@VincentTam VincentTam closed this Aug 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.