document.addEventListener(“DOMContentLoaded”, function () { const mainHeaderMenu = document.querySelector(“.main-header-menu”); if (!mainHeaderMenu) return; const mainMenuItemsWithChildren = mainHeaderMenu.querySelectorAll(“.wp-block-navigation-item.has-child”); const customContainer = document.querySelector(“.custom-submenu-container”); if (!customContainer) return; // Create overlay const overlay = document.createElement(“div”); overlay.classList.add(“custom-overlay”); document.body.appendChild(overlay); let isMenuOpen = false; let currentSubmenu = null; let eventListeners = new Map(); // Store event listeners for clean removal let hoverTimeout = null; function isDesktopView() { return window.innerWidth >= 768; } function openDesktopMenu(menuItem) { const submenu = menuItem.querySelector(“.wp-block-navigation__submenu-container”); if (!submenu) return; const submenuClone = submenu.cloneNode(true); customContainer.innerHTML = “”; customContainer.appendChild(submenuClone); customContainer.style.display = “flex”; overlay.style.display = “block”; isMenuOpen = true; currentSubmenu = menuItem; } function closeDesktopMenu() { customContainer.style.display = “none”; overlay.style.display = “none”; isMenuOpen = false; currentSubmenu = null; } // Function to add desktop-specific event handlers function setupDesktopBehavior() { if (!isDesktopView()) return; // First, remove any previously set listeners to avoid duplicates removeAllEventListeners(); mainMenuItemsWithChildren.forEach(menuItem => { // Hover handlers with better event handling const mouseEnterHandler = function (e) { // Clear any pending close timeout if (hoverTimeout) { clearTimeout(hoverTimeout); hoverTimeout = null; } // Only open if not already showing this menu if (currentSubmenu !== menuItem) { openDesktopMenu(menuItem); } }; const mouseLeaveHandler = function (e) { // Check if we’re actually leaving the menu item area const relatedTarget = e.relatedTarget; // Don’t close if moving to the custom container or staying within menu item if (relatedTarget && ( customContainer.contains(relatedTarget) || menuItem.contains(relatedTarget) )) { return; } // Delay closing to allow moving to submenu hoverTimeout = setTimeout(() => { closeDesktopMenu(); }, 200); }; eventListeners.set(menuItem, { mouseEnterHandler, mouseLeaveHandler }); menuItem.addEventListener(“mouseenter”, mouseEnterHandler); menuItem.addEventListener(“mouseleave”, mouseLeaveHandler); // Click handlers (for toggle behavior) const clickHandler = function (e) { e.preventDefault(); e.stopPropagation(); if (isMenuOpen && menuItem === currentSubmenu) { closeDesktopMenu(); } else { openDesktopMenu(menuItem); } }; eventListeners.set(menuItem + “_click”, clickHandler); menuItem.addEventListener(“click”, clickHandler); // Add the same toggle logic to the submenu toggle button const toggleButton = menuItem.querySelector(“.wp-block-navigation-submenu__toggle”); if (toggleButton) { const toggleHandler = function (e) { e.preventDefault(); e.stopPropagation(); if (isMenuOpen && menuItem === currentSubmenu) { closeDesktopMenu(); } else { openDesktopMenu(menuItem); } }; eventListeners.set(toggleButton, toggleHandler); toggleButton.addEventListener(“click”, toggleHandler); } }); // Add hover handlers to custom container to keep it open const containerMouseEnterHandler = function () { if (hoverTimeout) { clearTimeout(hoverTimeout); hoverTimeout = null; } }; const containerMouseLeaveHandler = function () { hoverTimeout = setTimeout(() => { closeDesktopMenu(); }, 200); }; eventListeners.set(customContainer, { containerMouseEnterHandler, containerMouseLeaveHandler }); customContainer.addEventListener(“mouseenter”, containerMouseEnterHandler); customContainer.addEventListener(“mouseleave”, containerMouseLeaveHandler); // Handle click outside to close menu const documentClickHandler = function (e) { if ( isMenuOpen && !customContainer.contains(e.target) && !currentSubmenu?.contains(e.target) ) { closeDesktopMenu(); } }; eventListeners.set(document, documentClickHandler); document.addEventListener(“click”, documentClickHandler); const overlayClickHandler = function () { closeDesktopMenu(); }; eventListeners.set(overlay, overlayClickHandler); overlay.addEventListener(“click”, overlayClickHandler); } // Function to remove all custom event listeners function removeAllEventListeners() { // Clear any pending timeout if (hoverTimeout) { clearTimeout(hoverTimeout); hoverTimeout = null; } eventListeners.forEach((handler, element) => { if (element === document) { document.removeEventListener(“click”, handler); } else if (element === overlay) { overlay.removeEventListener(“click”, handler); } else if (element === customContainer) { customContainer.removeEventListener(“mouseenter”, handler.containerMouseEnterHandler); customContainer.removeEventListener(“mouseleave”, handler.containerMouseLeaveHandler); } else if (typeof element === “string” && element.includes(“_click”)) { // Skip these, they’re handled differently } else if (handler.mouseEnterHandler) { const menuItem = element; menuItem.removeEventListener(“mouseenter”, handler.mouseEnterHandler); menuItem.removeEventListener(“mouseleave”, handler.mouseLeaveHandler); } else { element.removeEventListener(“click”, handler); } }); eventListeners.clear(); } // Function to handle view changes function handleViewChange() { if (isDesktopView()) { setupDesktopBehavior(); } else { // For mobile: completely remove our handlers removeAllEventListeners(); closeDesktopMenu(); } } // Initial setup handleViewChange(); // Handle window resize window.addEventListener(“resize”, function () { handleViewChange(); }); });

Point AI

Powered by AI and perfected by seasoned editors. Every story blends AI speed with human judgment.

EXCLUSIVE

Kenya’s ICT operators may soon require an operational licence 

law tech
Subject(s):

Psst… you’re reading Techpoint Digest

Every day, we handpick the biggest stories, skip the noise, and bring you a fun digest you can trust.

Digest Subscription (In-post)
  • Eliud Owalo, Cabinet Secretary, Ministry of ICT and Digital Economy, has reportedly proposed legislation in Kenya requiring information, communication, and technology (ICT) operators to obtain an operational licence if the proposed ICT Authority Bill 2024 is signed into law. 
  • The proposed ICT Authority Bill 2024 aims to improve the delivery of ICT services by ensuring their security, efficiency, and high quality, as well as simplifying ICT integration into public service delivery. 
  • The bill will also guide the authority in assigning accreditation categories based on experience and technical skills. It will allow the relevant authority to assign accreditation levels to individuals or organisations based on their ability to meet the prescribed requirements, such as skills, experience, and technical qualifications. 

“The Authority may assign categories of accreditation as the Authority may determine whether an applicant shall be a holder of the minimum technical qualifications and skills prescribed by the Authority for the class of contract works in respect of which registration is sought.” 

Meanwhile, applications are processed within 30 days of submission, and accreditation is granted if approved. If the applicant is rejected, the authority will inform him or her of the reasons.  

Moreover, approved and accredited applications must be renewed annually. If an ICT provider violates any accreditation conditions, the authority may suspend the approved certificate as it deems appropriate. 

This comes just a week after Kenya’s national treasury proposed a 1.5% digital tax on local platforms. Additionally, Njuguna Ndung’u, the national treasury cabinet secretary, proposed amendments to the Finance Bill 2024 for foreign companies with a presence in Kenya to pay digital service tax. 

In June 2023, Kenya’s government allocated $109.6 million to fund ICT-related initiatives as part of its fiscal year 2023/2024 budget. 

The World Bank has also supported the country’s digital economy. In the same year, the World Bank Group Board of Directors approved $390 million in financing for the first phase of the Kenya Digital Economy Acceleration Project. The first phase, which began in 2023, will continue until 2028, while the second phase will start in 2026 and end in 2030.

Follow Techpoint Africa on WhatsApp!

Never miss a beat on tech, startups, and business news from across Africa with the best of journalism.

Follow

Read next