oiax / tgweb

MIT License
8 stars 2 forks source link

Allow tg:toggler to prevent event propagation for displayed elements #185

Open kuroda opened 5 months ago

kuroda commented 5 months ago

The general technique used to prevent scrolling with the mouse wheel over an open hamburger menu is as follows:

let toggleIsFixed = function(active) {
  const htmlElem = document.getElementsByTagName("html").item(0);
  if (active) htmlElem.classList.add("is-fixed")
  else htmlElem.classList.remove("is-fixed");
}
html.is-fixed,
html.is-fixed body {
  height: 100%;
  overflow: hidden;
}

Consider using the Event.stopPropagation() method.

kuroda commented 5 months ago

Introduce tg:stop="mousewheel".