Skip to content

Commit f1a9751

Browse files
committed
Allow clicking on modal do dismiss and decline
1 parent 01178f1 commit f1a9751

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

styles/all/template/webpush.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,32 @@ function PhpbbWebpush() {
158158

159159
const allowBtn = document.getElementById('wpn_popup_allow');
160160
const declineBtn = document.getElementById('wpn_popup_decline');
161+
const overlay = document.getElementById('wpn_popup_prompt');
161162

162163
if (allowBtn) {
163-
allowBtn.addEventListener('click', () => {
164+
allowBtn.addEventListener('click', (event) => {
165+
event.stopPropagation();
164166
popup.style.display = 'none';
165167
subscribeButtonHandler({ preventDefault: () => {} });
166168
});
167169
}
168170

169171
if (declineBtn) {
170-
declineBtn.addEventListener('click', () => {
172+
declineBtn.addEventListener('click', (event) => {
173+
event.stopPropagation();
171174
popup.style.display = 'none';
172175
setDeclined();
173176
});
174177
}
178+
179+
if (overlay) {
180+
overlay.addEventListener('click', (event) => {
181+
if (event.target === overlay) {
182+
popup.style.display = 'none';
183+
setDeclined();
184+
}
185+
});
186+
}
175187
}
176188

177189
/**

0 commit comments

Comments
 (0)