chore(css): style tweaks for overflow
This commit is contained in:
		@@ -12,7 +12,7 @@ async function mouseEnterHandler(
 | 
			
		||||
  clearActivePopover()
 | 
			
		||||
 | 
			
		||||
  const link = this
 | 
			
		||||
  link.id = `backlink-${randomIdNonSecure()}`
 | 
			
		||||
  const id = randomIdNonSecure()
 | 
			
		||||
  if (link.dataset.noPopover === "true") {
 | 
			
		||||
    return
 | 
			
		||||
  }
 | 
			
		||||
@@ -27,8 +27,8 @@ async function mouseEnterHandler(
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const prevPopoverElement = document.getElementById(`popover-${link.id.split("-")[1]}`)
 | 
			
		||||
  const hasAlreadyBeenFetched = () => !!prevPopoverElement
 | 
			
		||||
  const prevPopoverElement = document.getElementById(`popover-${id}`)
 | 
			
		||||
  const hasAlreadyBeenFetched = () => !!document.getElementById(`popover-${id}`)
 | 
			
		||||
 | 
			
		||||
  // dont refetch if there's already a popover
 | 
			
		||||
  if (hasAlreadyBeenFetched()) {
 | 
			
		||||
@@ -91,7 +91,7 @@ async function mouseEnterHandler(
 | 
			
		||||
      normalizeRelativeURLs(html, targetUrl)
 | 
			
		||||
      // prepend all IDs inside popovers to prevent duplicates
 | 
			
		||||
      html.querySelectorAll("[id]").forEach((el) => {
 | 
			
		||||
        const targetID = `popover-${el.id}`
 | 
			
		||||
        const targetID = `popover-internal-${el.id}`
 | 
			
		||||
        el.id = targetID
 | 
			
		||||
      })
 | 
			
		||||
      const elts = [...html.getElementsByClassName("popover-hint")]
 | 
			
		||||
@@ -101,12 +101,12 @@ async function mouseEnterHandler(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setPosition(popoverElement)
 | 
			
		||||
  popoverElement.id = `popover-${link.id.split("-")[1]}`
 | 
			
		||||
  popoverElement?.classList.add("active-popover")
 | 
			
		||||
  popoverElement.id = `popover-${id}`
 | 
			
		||||
  popoverElement.classList.add("active-popover")
 | 
			
		||||
  document.body.appendChild(popoverElement)
 | 
			
		||||
 | 
			
		||||
  if (hash !== "") {
 | 
			
		||||
    const targetAnchor = hash.startsWith("#popover") ? hash : `#popover-${hash.slice(1)}`
 | 
			
		||||
    const targetAnchor = `#popover-internal-${hash.slice(1)}`
 | 
			
		||||
    const heading = popoverInner.querySelector(targetAnchor) as HTMLElement | null
 | 
			
		||||
    if (heading) {
 | 
			
		||||
      // leave ~12px of buffer when scrolling to a heading
 | 
			
		||||
 
 | 
			
		||||
@@ -8,11 +8,11 @@
 | 
			
		||||
    margin: 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  & > ul {
 | 
			
		||||
  & > ul.overflow {
 | 
			
		||||
    list-style: none;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    margin: 0.5rem 0;
 | 
			
		||||
    height: 6rem;
 | 
			
		||||
    max-height: calc(100% - 2rem);
 | 
			
		||||
    overscroll-behavior: contain;
 | 
			
		||||
 | 
			
		||||
    & > li {
 | 
			
		||||
 
 | 
			
		||||
@@ -3,18 +3,11 @@
 | 
			
		||||
.toc {
 | 
			
		||||
  display: flex;
 | 
			
		||||
  flex-direction: column;
 | 
			
		||||
 | 
			
		||||
  overflow-y: hidden;
 | 
			
		||||
  min-height: 1.2rem;
 | 
			
		||||
  flex: 0 1 auto;
 | 
			
		||||
  min-height: 1.4rem;
 | 
			
		||||
  flex: 0 0.5 auto;
 | 
			
		||||
  &:has(button.toc-header.collapsed) {
 | 
			
		||||
    flex: 0 1 1.2rem;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@media all and not ($mobile) {
 | 
			
		||||
  .toc-header {
 | 
			
		||||
    display: flex;
 | 
			
		||||
    flex: 0 1 1.4rem;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -45,15 +38,15 @@ button.toc-header {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ul.toc-content {
 | 
			
		||||
ul.toc-content.overflow {
 | 
			
		||||
  list-style: none;
 | 
			
		||||
  position: relative;
 | 
			
		||||
  margin: 0.5rem 0;
 | 
			
		||||
  padding: 0;
 | 
			
		||||
  height: 5rem;
 | 
			
		||||
  max-height: calc(100% - 2rem);
 | 
			
		||||
  overscroll-behavior: contain;
 | 
			
		||||
 | 
			
		||||
  list-style: none;
 | 
			
		||||
 | 
			
		||||
  & > li > a {
 | 
			
		||||
    color: var(--dark);
 | 
			
		||||
    opacity: 0.35;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user