Fix: Only block clicks on private services that have data-service attribute (modals), allow others to link normally

This commit is contained in:
Roberth Rajala 2026-02-02 13:15:24 +01:00
parent 1554402d76
commit b53ff9c345
1 changed files with 5 additions and 3 deletions

View File

@ -594,20 +594,22 @@ document.addEventListener('DOMContentLoaded', initServiceStatusChecker);
* Service Info Modals * Service Info Modals
*/ */
function initServiceModals() { function initServiceModals() {
const privateServices = document.querySelectorAll('.private-service'); // Only handle services that have data-service attribute (not links to dummy pages)
const privateServices = document.querySelectorAll('.private-service[data-service]');
const modals = document.querySelectorAll('.service-modal'); const modals = document.querySelectorAll('.service-modal');
const closeButtons = document.querySelectorAll('.modal-close'); const closeButtons = document.querySelectorAll('.modal-close');
// Open modal when clicking private service // Open modal when clicking private service that has a modal
privateServices.forEach(service => { privateServices.forEach(service => {
service.addEventListener('click', (e) => { service.addEventListener('click', (e) => {
e.preventDefault();
const serviceName = service.getAttribute('data-service'); const serviceName = service.getAttribute('data-service');
const modal = document.getElementById(`modal-${serviceName}`); const modal = document.getElementById(`modal-${serviceName}`);
if (modal) { if (modal) {
e.preventDefault();
modal.classList.add('active'); modal.classList.add('active');
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
} }
// If no modal exists, let the link work normally
}); });
}); });