The library page begins with Hours not checked. Add a click listener so its button updates the status only when someone activates it.
The park demo used a function reference without parentheses; here is a separate cafe example. Both keep a native button for built-in keyboard activation. If you write announceHours() inside addEventListener, it runs at setup time and hands the listener its return value instead of waiting for a click.
// Different example: a cafe, not your library.
function revealSpecial() {
document.querySelector("#special").textContent = "Soup today";
}
document.querySelector("#menu-button").addEventListener("click", revealSpecial);
Run the page before and after activating the button. Only the activation should change the status to Open until 6 pm. Keep role="status" so the changed message can be announced without moving focus.
A listener is registration, not an immediate call. The button supplies keyboard activation automatically; JavaScript only supplies the response.
showHours that sets #hours text to Open until 6 pm.showHours as the click listener of #hours-button without invoking it during page setup.Pass showHours rather than showHours() to addEventListener.