Repository: CoralPink/commentary
Pull request #420: View footnote on the fly 🛸
Author: login: CoralPink
Created: 2025-04-28T09:00:43Z | Merged: 2025-04-28T10:07:59Z

This PR is to allow footnotes on the site to be displayed on the fly.

I think I've packed in a reasonable amount of what I want to do,
but it's not the most flattering or sophisticated code, so if you have any good ideas, please let me know! 😣

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced interactive footnote popovers that appear when clicking on footnote references, enhancing readability and accessibility.
  - Footnote references now use buttons instead of links for improved interaction.

- **Style**
  - Updated footnote reference styling from links to buttons and added new styles for footnote popover appearance and transitions.

- **Chores**
  - Updated version numbers for both the service worker and the footnote package.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/js/book.ts b/js/book.ts
index 84f3a6d9e..0f088c084 100644
--- a/js/book.ts
+++ b/js/book.ts
@@ -1,4 +1,5 @@
 import { procCodeBlock } from './codeblock';
+import { initFootnote } from './footnote';
 import { startupSearch } from './searcher';
 import { initSidebar } from './sidebar';
 import { initTableOfContents } from './table-of-contents';
@@ -15,6 +16,8 @@ const initialize = (): void => {
 
   initThemeColor(rootPath);
   initTableOfContents();
+  initFootnote();
+
   procCodeBlock();
 
   initWasm().then(
diff --git a/js/footnote.ts b/js/footnote.ts
new file mode 100644
index 000000000..c4226627b
--- /dev/null
+++ b/js/footnote.ts
@@ -0,0 +1,82 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  tip.setAttribute('role', 'tooltip');
+  tip.setAttribute('id', `popover-${href.slice(1)}`);
+
+  target.setAttribute('aria-expanded', 'true');
+  target.setAttribute('aria-controls', `popover-${href.slice(1)}`);
+
+  document.body.appendChild(tip);
+
+  const rect = (target as HTMLElement).getBoundingClientRect();
+  const popHeight = tip.offsetHeight;
+  const gap = 10;
+  let top = rect.bottom + gap;
+
+  // Flip above if overflowing viewport bottom
+  if (top + popHeight > window.innerHeight - gap) {
+    top = rect.top - popHeight - gap;
+  }
+  tip.style.position = 'absolute';
+  tip.style.top = `${top + window.scrollY}px`;
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  // Connect the button to the popover for accessibility
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+
+      target.setAttribute('aria-expanded', 'false');
+      target.removeAttribute('aria-controls');
+
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
+
+export const initFootnote = (): void => {
+  for (const sup of Array.from(document.querySelectorAll('sup.ft-reference'))) {
+    sup.addEventListener('click', ev => handleFootnoteClick(ev.target), { once: false, passive: true });
+  }
+};
diff --git a/js/serviceworker.ts b/js/serviceworker.ts
index 75d222f87..41c9fd006 100644
--- a/js/serviceworker.ts
+++ b/js/serviceworker.ts
@@ -1,6 +1,6 @@
 declare const self: ServiceWorkerGlobalScope;
 
-const CACHE_VERSION = 'v7.1.1';
+const CACHE_VERSION = 'v7.2.0';
 
 const CACHE_HOST = 'https://coralpink.github.io/';
 const CACHE_URL = '/commentary/';
diff --git a/rs/mdbook-footnote/Cargo.lock b/rs/mdbook-footnote/Cargo.lock
index 257412ce0..256fad1b3 100644
--- a/rs/mdbook-footnote/Cargo.lock
+++ b/rs/mdbook-footnote/Cargo.lock
@@ -1226,7 +1226,7 @@ dependencies = [
 
 [[package]]
 name = "mdbook-footnote"
-version = "1.5.0"
+version = "1.6.0"
 dependencies = [
  "clap",
  "mdbook",
diff --git a/rs/mdbook-footnote/Cargo.toml b/rs/mdbook-footnote/Cargo.toml
index 78cb908ca..58f2aabea 100644
--- a/rs/mdbook-footnote/Cargo.toml
+++ b/rs/mdbook-footnote/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "mdbook-footnote"
-version = "1.5.0"
+version = "1.6.0"
 authors = ["David Drysdale <dmd@lurklurk.org>", "CoralPink"]
 edition = "2024"
 rust-version = "1.85"
diff --git a/rs/mdbook-footnote/src/lib.rs b/rs/mdbook-footnote/src/lib.rs
index 4fa8d1477..07adb0bfe 100644
--- a/rs/mdbook-footnote/src/lib.rs
+++ b/rs/mdbook-footnote/src/lib.rs
@@ -19,7 +19,7 @@ pub fn replacing(mut book: Book) -> Result<Book, Error> {
                     footnotes.push(content);
 
                     let idx = footnotes.len();
-                    format!("<sup class=\"{FT_REF}\"><a name=\"to-ft-{idx}\" href=\"#ft-{idx}\">{idx}</a></sup>")
+                    format!("<sup class=\"{FT_REF}\"><button id=\"to-ft-{idx}\" data-href=\"#ft-{idx}\">{idx}</button></sup>")
                 })
                 .to_string();
 
diff --git a/rs/mdbook-footnote/test/ok.md b/rs/mdbook-footnote/test/ok.md
index b3007b28b..e40ca8cf5 100644
--- a/rs/mdbook-footnote/test/ok.md
+++ b/rs/mdbook-footnote/test/ok.md
@@ -1,7 +1,7 @@
 # 🎠 Watching the Wheels
 
 ```admonish success title=""
-I'm just sitting here watching the wheels<sup class="ft-reference"><a name="to-ft-1" href="#ft-1">1</a></sup>go 'round and 'round
+I'm just sitting here watching the wheels<sup class="ft-reference"><button id="to-ft-1" data-href="#ft-1">1</button></sup>go 'round and 'round
 
 I really love to watch them roll
 
diff --git a/scss/_footnote.scss b/scss/_footnote.scss
index d67fef5f0..dacf1f270 100644
--- a/scss/_footnote.scss
+++ b/scss/_footnote.scss
@@ -8,15 +8,61 @@
   a {
     text-decoration: none;
   }
-
   p {
     display: inline;
   }
 }
 
 .ft-reference {
-  a {
+  button {
     text-decoration: none;
     scroll-margin-top: var.$menu-bar-height;
+
+    background: none;
+    border: none;
+    color: var(--links);
+    cursor: pointer;
+    padding: 0;
+    font: inherit;
+  }
+}
+
+.ft-pop {
+  color: var(--fg);
+  background-color: var(--theme-popup-bg);
+  border: .1rem solid var(--theme-popup-border);
+
+  width: 88vw;
+  max-height: 64vw;
+  margin: 1rem auto;
+  padding: 1rem 1rem;
+  border-radius: .8rem;
+  font-size: .64rem;
+  text-align: left;
+  overflow-y: scroll;
+
+  position: absolute;
+  transform: translateX(-50%) scale(0.95);
+  left: 50%;
+  z-index: 20;
+  opacity: 0;
+  transition: opacity 150ms ease, transform 150ms ease;
+
+  &.show {
+    opacity: 1;
+    transform: translateX(-50%) scale(1);
+  }
+
+  a {
+    text-decoration: none;
+
+    &:link, &:visited {
+      color: var(--links);
+      margin-left: .2em;
+      margin-right: .2em;
+    }
+  }
+  p {
+    display: inline;
   }
 }


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 3**

<details>
<summary>🔭 Outside diff range comments (1)</summary><blockquote>

<details>
<summary>js/footnote.ts (1)</summary><blockquote>

`1-60`: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**Consider an alternative placement for the popover.**

Currently, the popover is appended to the footnote reference, which might cause positioning issues in certain layouts. Consider adding it to the document body instead.

```diff
 const handleFootnoteClick = (target: EventTarget | null): void => {
   // ... existing code ...
   
-  target.appendChild(tip);
+  // Position the popover relative to the target but append to body
+  document.body.appendChild(tip);
+  const targetRect = target.getBoundingClientRect();
+  const scrollY = window.scrollY || document.documentElement.scrollTop;
+  
+  // Position below the reference
+  tip.style.top = `${targetRect.bottom + scrollY + 10}px`; // 10px gap
+  // Center horizontally (already handled in CSS with transform)
   
   // ... rest of the function ...
 };
```

Consider exploring how this popover behaves when a footnote is near the bottom or edge of the viewport. The current implementation might cause the popover to be cut off or extend beyond the viewport boundaries.

---

🏁 Script executed:

```shell
#!/bin/bash
# Find any CSS that handles edge case positioning for popovers
rg -t css "position|overflow|z-index" --glob "scss/*.scss"
```

Length of output: 1255

---

🏁 Script executed:

```shell
#!/bin/bash
# Extract the CSS rules for the popover component
rg -n -C5 '\.ft-pop' scss/_footnote.scss
```

Length of output: 255

---

🏁 Script executed:

```shell
#!/bin/bash
# Display .ft-pop CSS rules with more context
rg -n -C10 '\.ft-pop' scss/_footnote.scss
```

Length of output: 476

---

🏁 Script executed:

```shell
#!/bin/bash
# Locate ft-pop positioning, z-index, and overflow rules
rg -n -C2 'position: absolute' scss/_footnote.scss
rg -n -C2 'z-index' scss/_footnote.scss
rg -n -C2 'overflow-y' scss/_footnote.scss
```

Length of output: 508

---



</details>

**Improve popover placement and prevent viewport overflow**

The current `.ft-pop` is absolutely positioned with `left: 50%` + `translateX(-50%)`, a fixed `width: 88vw`, and a vertical `margin: 1rem auto`. While it scrolls (`overflow-y: scroll`) and sits above the reference by default, there’s no logic to flip it when it would extend past the bottom (or top) of the viewport.

To address this:

- Append the popover to `document.body` instead of the reference to avoid clipping by parent containers.
- Compute its `top`/`left` in JS based on the trigger’s bounding rect.
- Flip vertically if it would overflow the viewport.
- Retain centering with `transform: translateX(-50%)`.

Suggested diff:

```diff
 const handleFootnoteClick = (target: EventTarget | null): void => {
   // …existing lookup and content setup…

-  target.appendChild(tip);
+  document.body.appendChild(tip);
+  const rect = (target as HTMLElement).getBoundingClientRect();
+  const popHeight = tip.offsetHeight;
+  const gap = 10;
+  let top = rect.bottom + gap;
+  // Flip above if overflowing viewport bottom
+  if (top + popHeight > window.innerHeight - gap) {
+    top = rect.top - popHeight - gap;
+  }
+  tip.style.position = 'absolute';
+  tip.style.top = `${top + window.scrollY}px`;
+  tip.style.left = `${rect.left + rect.width / 2 + window.scrollX}px`;
+  tip.style.transform = 'translateX(-50%)';

-  requestAnimationFrame(() => {
+  requestAnimationFrame(() => {
     tip.classList.add('show');
   });

   // …rest of the click-outside handler…
 };
```

This ensures the popover remains fully visible near viewport edges.

</blockquote></details>

</blockquote></details>

<details>
<summary>🧹 Nitpick comments (2)</summary><blockquote>

<details>
<summary>scss/_footnote.scss (2)</summary><blockquote>

`10-10`: **Remove unnecessary semicolon after closing brace.**

The semicolon after the closing brace is not required in SCSS and should be removed for consistency.

```diff
-  };
+  }
```

---

`30-62`: **Popover styling looks good but has the same semicolon issue.**

The popover styling is comprehensive with good transition effects, but has the same semicolon after closing brace issue on line 58.

```diff
-  };
+  }
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 8819546e3bfab36277a627478e7d203eeda6f093 and bc7afdbbd53edc6ceb6069a00347960759c74bb2.

</details>

<details>
<summary>⛔ Files ignored due to path filters (1)</summary>

* `rs/mdbook-footnote/Cargo.lock` is excluded by `!**/*.lock`

</details>

<details>
<summary>📒 Files selected for processing (7)</summary>

* `js/book.ts` (2 hunks)
* `js/footnote.ts` (1 hunks)
* `js/serviceworker.ts` (1 hunks)
* `rs/mdbook-footnote/Cargo.toml` (1 hunks)
* `rs/mdbook-footnote/src/lib.rs` (1 hunks)
* `rs/mdbook-footnote/test/ok.md` (1 hunks)
* `scss/_footnote.scss` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>📓 Common learnings</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

</details><details>
<summary>🧬 Code Graph Analysis (1)</summary>

<details>
<summary>js/book.ts (1)</summary><blockquote>

<details>
<summary>js/footnote.ts (1)</summary>

* `initFootnote` (55-59)

</details>

</blockquote></details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (5)</summary>

* GitHub Check: Test mdBook Backend
* GitHub Check: Test Wasm
* GitHub Check: Analyze (python)
* GitHub Check: Analyze (javascript)
* GitHub Check: Analyze (actions)

</details>

<details>
<summary>🔇 Additional comments (8)</summary><blockquote>

<details>
<summary>rs/mdbook-footnote/src/lib.rs (1)</summary>

`22-22`: **Good approach to making footnotes interactive**

The change from anchor tags to button elements is a well-chosen approach for implementing the "view footnote on the fly" functionality. Using a button with `data-href` instead of an anchor with `href` prevents page navigation while maintaining the reference to the footnote content.

</details>
<details>
<summary>rs/mdbook-footnote/Cargo.toml (1)</summary>

`3-3`: **Appropriate version increment**

The version increment from 1.5.0 to 1.6.0 correctly follows semantic versioning principles for adding a new feature (interactive footnotes) without breaking existing functionality.

</details>
<details>
<summary>js/book.ts (2)</summary>

`2-2`: **Clean import of the new footnote module**

The import statement is correctly added to bring in the footnote functionality.

---

`19-20`: **Well-positioned initialization call**

The `initFootnote()` call is appropriately placed in the initialization sequence after TOC initialization and before code block processing. This ensures the footnote functionality is ready when the user interacts with the page.

</details>
<details>
<summary>js/serviceworker.ts (2)</summary>

`3-3`: **Appropriate cache version increment**

The cache version bump from 'v7.1.1' to 'v7.2.0' aligns with the feature version increment in Cargo.toml and ensures clients will receive the updated assets with footnote functionality.

---

`1-149`: <details>
<summary>✅ Verification successful</summary>

**Consider adding the footnote JS file to CACHE_LIST**

I notice that while you've updated the cache version, the new footnote JavaScript file isn't explicitly listed in the `CACHE_LIST` array. If it's bundled with other files like `book.js` then this is fine, but if it's loaded separately, consider adding it to ensure it's cached properly.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check the build output structure to verify if footnote.js exists as a separate file
fd -p ".*footnote.*\.js$" 
```

Length of output: 27

---

🏁 Script executed:

```shell
#!/bin/bash
# More thorough search for any JS file named with 'footnote'
fd -g '*footnote*.js'

# Search for any references or imports of 'footnote' in JS/TS files
rg -l 'footnote' --glob '*.js' --glob '*.ts'
```

Length of output: 94

---

🏁 Script executed:

```shell
#!/bin/bash
# Display the top of book.ts to check for footnote imports
sed -n '1,50p' js/book.ts

# Display the top of footnote.ts to see its exports
sed -n '1,50p' js/footnote.ts
```

Length of output: 2352

---



</details>

**Footnote code is bundled into `book.js`—no separate caching needed**

The `footnote.ts` module is imported by `js/book.ts` and compiled into the `book.js` bundle. Since there is no standalone `footnote.js` file in your static output, caching `book.js` already covers the footnote functionality.

</details>
<details>
<summary>rs/mdbook-footnote/test/ok.md (1)</summary>

`4-4`: **The footnote reference markup is now semantically better as a button.**

The change from `<a>` tag to `<button>` with `data-href` attribute is appropriate for interactive elements that display content rather than navigate. This aligns with the new popover implementation.

</details>
<details>
<summary>js/footnote.ts (1)</summary>

`1-12`: **Good approach for smooth popover removal.**

Using the `transitionend` event listener to only remove the element after the opacity transition completes creates a smooth user experience.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T09:06:41Z
user: login: CoralPink
state: COMMENTED
author_association: OWNER
submitted_at: 2025-04-28T09:09:20Z
user: login: coderabbitai[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T09:09:44Z
user: login: CoralPink
state: COMMENTED
author_association: OWNER
submitted_at: 2025-04-28T09:21:50Z
user: login: coderabbitai[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T09:22:23Z
user: login: CoralPink
state: COMMENTED
author_association: OWNER
submitted_at: 2025-04-28T09:26:06Z
user: login: coderabbitai[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T09:26:29Z
user: login: CoralPink
state: COMMENTED
author_association: OWNER
submitted_at: 2025-04-28T09:28:50Z
user: login: coderabbitai[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T09:29:17Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>♻️ Duplicate comments (1)</summary><blockquote>

<details>
<summary>js/footnote.ts (1)</summary><blockquote>

`78-82`: **Consider adding support for keyboard navigation.**

The initialization looks good, but could be enhanced with keyboard support in a future iteration. This would allow users to navigate between footnotes using keyboard shortcuts.



I understand from past comments that you prefer to defer enhancements like keyboard navigation to future PRs, especially considering potential conflicts with existing keyboard handlers (like the Esc key for the side menu).

</blockquote></details>

</blockquote></details>

<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>

<details>
<summary>js/footnote.ts (1)</summary><blockquote>

`41-57`: **Smart popover positioning with viewport overflow handling.**

The positioning logic intelligently places the popover below or above the reference based on available viewport space, preventing content from being cut off at the bottom of the screen.


Consider adding horizontal overflow handling for very wide footnotes on narrow screens:

```diff
  // Flip above if overflowing viewport bottom
  if (top + popHeight > window.innerHeight - gap) {
    top = rect.top - popHeight - gap;
  }
+ 
+ // Ensure popover stays within horizontal bounds
+ const popWidth = tip.offsetWidth;
+ const leftPosition = rect.left + (rect.width / 2) - (popWidth / 2);
+ const rightEdge = leftPosition + popWidth;
+ 
+ if (rightEdge > document.documentElement.clientWidth - gap) {
+   tip.style.left = `${document.documentElement.clientWidth - popWidth - gap + window.scrollX}px`;
+   tip.style.transform = 'none';
+ } else if (leftPosition < gap) {
+   tip.style.left = `${gap + window.scrollX}px`;
+   tip.style.transform = 'none';
+ } else {
+   tip.style.left = '50%';
+   tip.style.transform = 'translateX(-50%)';
+ }
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between bc7afdbbd53edc6ceb6069a00347960759c74bb2 and 24af16fedfa793ec0f517125575f537524094c4a.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `js/footnote.ts` (1 hunks)
* `scss/_footnote.scss` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (2)</summary>

<details>
<summary>📓 Common learnings</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>
<details>
<summary>js/footnote.ts (2)</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: Analyze (actions)
* GitHub Check: Analyze (javascript)
* GitHub Check: Analyze (python)

</details>

<details>
<summary>🔇 Additional comments (6)</summary><blockquote>

<details>
<summary>scss/_footnote.scss (3)</summary>

`17-27`: **Good button styling for footnote references.**

The transition from anchor to button elements is well-implemented with appropriate styling that preserves the link-like appearance while using the more semantically correct button element. Setting `background: none`, `border: none`, and `font: inherit` effectively removes default button styling.

---

`30-54`: **Well-structured popover styling with proper transitions.**

The popover styling is comprehensive with appropriate positioning, transitions, and responsive sizing. The transition properties (opacity and transform) with easing create a smooth appearance/disappearance effect that matches the JavaScript implementation.

---

`56-67`: **Good styling for links and paragraphs within the popover.**

The nested styling for links and paragraphs within the popover ensures content is readable and maintains consistent styling with the rest of the site. Setting `display: inline` for paragraphs prevents unwanted line breaks.

</details>
<details>
<summary>js/footnote.ts (3)</summary>

`1-12`: **Clean popover closing with proper transition handling.**

The `closePopover` function correctly handles the animation sequence by removing the "show" class first, then listening for the transition to complete before removing the element from the DOM. This ensures smooth visual transitions.

---

`14-40`: **Well-implemented footnote click handler with proper accessibility attributes.**

The click handler has good type checking and validation before creating the popover. The addition of accessibility attributes (`role="tooltip"`, `aria-expanded`, and `aria-controls`) improves the user experience for screen reader users.

---

`59-76`: **Well-implemented click outside handler with proper cleanup.**

The click outside handler correctly identifies clicks outside the popover and target, then cleans up both the popover and event listeners. The accessibility attributes are appropriately updated when the popover closes.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T09:53:10Z

Review comments:
diff_hunk: @@ -7,16 +7,56 @@
 
   a {
     text-decoration: none;
-  }
-
+  };
   p {
     display: inline;
   }
 }
 
 .ft-reference {
-  a {
+  button {
     text-decoration: none;
     scroll-margin-top: var.$menu-bar-height;
+
+    background: none;
+    border: none;
+    color: --links;
+    cursor: pointer;
+    padding: 0;
+    font: inherit;
+  }
path: scss/_footnote.scss
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Fix CSS variable syntax for color property.**

The CSS variable for links color is incorrectly specified. CSS variables need to be referenced using the `var()` function.

```diff
-    color: --links;
+    color: var(--links);
```

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-04-28T09:06:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
+
+export const initFootnote = (): void => {
+  for (const sup of Array.from(document.querySelectorAll('sup.ft-reference'))) {
+    sup.addEventListener('click', ev => handleFootnoteClick(ev.target), { once: false, passive: true });
+  }
+};
path: js/footnote.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Consider closing existing popovers when opening a new one.**

The current implementation doesn't handle the case where a user clicks on a different footnote when one is already open.

```diff
 export const initFootnote = (): void => {
+  // Function to close any open popovers
+  const closeOpenPopovers = () => {
+    const openPopovers = document.querySelectorAll('.ft-pop.show');
+    openPopovers.forEach((popover) => {
+      if (popover instanceof HTMLElement) {
+        const parent = popover.parentElement;
+        if (parent) {
+          parent.setAttribute('aria-expanded', 'false');
+          parent.removeAttribute('aria-controls');
+        }
+        closePopover(popover);
+      }
+    });
+  };
+  
   for (const sup of Array.from(document.querySelectorAll('sup.ft-reference'))) {
-    sup.addEventListener('click', ev => handleFootnoteClick(ev.target), { once: false, passive: true });
+    sup.addEventListener('click', ev => {
+      // Close any open popovers first
+      closeOpenPopovers();
+      handleFootnoteClick(ev.target);
+    }, { once: false, passive: true });
   }
 };
```

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-04-28T09:06:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
path: js/footnote.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Consider enhancing keyboard accessibility.**

The click handling works well, but the implementation could be improved for keyboard accessibility.

```diff
 const handleFootnoteClick = (target: EventTarget | null): void => {
   if (!(target instanceof HTMLElement)) {
     return;
   }

   const href = target.getAttribute('data-href');

   if (!href) {
     return;
   }

   const footnote = document.getElementById(href.slice(1));

   if (!footnote) {
     return;
   }

   const tip = document.createElement('aside');
   tip.setAttribute('class', 'ft-pop');
   tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+  tip.setAttribute('role', 'tooltip');
+  tip.setAttribute('id', `popover-${href.slice(1)}`);
+  
+  // Connect the button to the popover for accessibility
+  target.setAttribute('aria-expanded', 'true');
+  target.setAttribute('aria-controls', `popover-${href.slice(1)}`);

   const onClickOutside = (ev: MouseEvent) => {
     if (!(ev.target instanceof Node)) {
       return;
     }

     if (!tip.contains(ev.target) && target !== ev.target) {
       closePopover(tip);
       document.removeEventListener('click', onClickOutside);
+      target.setAttribute('aria-expanded', 'false');
+      target.removeAttribute('aria-controls');
     }
   };

+  // Close popover on Escape key
+  const onKeyDown = (ev: KeyboardEvent) => {
+    if (ev.key === 'Escape') {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+      document.removeEventListener('keydown', onKeyDown);
+      target.setAttribute('aria-expanded', 'false');
+      target.removeAttribute('aria-controls');
+    }
+  };
+
+  document.addEventListener('keydown', onKeyDown, { once: false, passive: true });

   target.appendChild(tip);

   requestAnimationFrame(() => {
     tip.classList.add('show');
   });

   document.addEventListener('click', onClickOutside, { once: false, passive: true });
 };
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
const handleFootnoteClick = (target: EventTarget | null): void => {
  if (!(target instanceof HTMLElement)) {
    return;
  }

  const href = target.getAttribute('data-href');

  if (!href) {
    return;
  }

  const footnote = document.getElementById(href.slice(1));

  if (!footnote) {
    return;
  }

  const tip = document.createElement('aside');
  tip.setAttribute('class', 'ft-pop');
  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
  tip.setAttribute('role', 'tooltip');
  tip.setAttribute('id', `popover-${href.slice(1)}`);

  // Connect the button to the popover for accessibility
  target.setAttribute('aria-expanded', 'true');
  target.setAttribute('aria-controls', `popover-${href.slice(1)}`);

  const onClickOutside = (ev: MouseEvent) => {
    if (!(ev.target instanceof Node)) {
      return;
    }

    if (!tip.contains(ev.target) && target !== ev.target) {
      closePopover(tip);
      document.removeEventListener('click', onClickOutside);
      target.setAttribute('aria-expanded', 'false');
      target.removeAttribute('aria-controls');
    }
  };

  // Close popover on Escape key
  const onKeyDown = (ev: KeyboardEvent) => {
    if (ev.key === 'Escape') {
      closePopover(tip);
      document.removeEventListener('click', onClickOutside);
      document.removeEventListener('keydown', onKeyDown);
      target.setAttribute('aria-expanded', 'false');
      target.removeAttribute('aria-controls');
    }
  };

  document.addEventListener('keydown', onKeyDown, { once: false, passive: true });

  target.appendChild(tip);

  requestAnimationFrame(() => {
    tip.classList.add('show');
  });

  document.addEventListener('click', onClickOutside, { once: false, passive: true });
};
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-04-28T09:06:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -7,16 +7,56 @@
 
   a {
     text-decoration: none;
-  }
-
+  };
   p {
     display: inline;
   }
 }
 
 .ft-reference {
-  a {
+  button {
     text-decoration: none;
     scroll-margin-top: var.$menu-bar-height;
+
+    background: none;
+    border: none;
+    color: --links;
+    cursor: pointer;
+    padding: 0;
+    font: inherit;
+  }
path: scss/_footnote.scss
user: login: CoralPink
body: It's true...
Thanks for noticing!
created_at: 2025-04-28T09:09:20Z
author_association: OWNER
diff_hunk: @@ -7,16 +7,56 @@
 
   a {
     text-decoration: none;
-  }
-
+  };
   p {
     display: inline;
   }
 }
 
 .ft-reference {
-  a {
+  button {
     text-decoration: none;
     scroll-margin-top: var.$menu-bar-height;
+
+    background: none;
+    border: none;
+    color: --links;
+    cursor: pointer;
+    padding: 0;
+    font: inherit;
+  }
path: scss/_footnote.scss
user: login: coderabbitai[bot]
body: @CoralPink Happy to help! The CSS variable syntax fix is a small but important detail. Your "View footnote on the fly" feature looks great - it's a nice usability enhancement that will make the reading experience more seamless. Let me know if you need any further assistance with this PR!



---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

---

<!-- This is an auto-generated comment: tweet message by coderabbit.ai -->

If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Catch%20CSS%20bugs%20early!%20%40coderabbitai%20spotted%20a%20missing%20var()%20around%20a%20CSS%20variable%E2%80%94crucial%20for%20proper%20styling.%20Save%20time%20%26%20avoid%20errors%20with%20smart%20code%20reviews!%20%F0%9F%8E%AF%E2%9C%A8&url=https%3A%2F%2Fgithub.com%2FCoralPink%2Fcommentary%2Fpull%2F420%23discussion_r2063241718)?

Thank you for using CodeRabbit!

<!-- end of auto-generated comment: tweet message by coderabbit.ai -->




<!-- <agentComponentType>chat-answer</agentComponentType> -->

<!-- <rawResChunk><answer>@CoralPink Happy to help! The CSS variable syntax fix is a small but important detail. Your "View footnote on the fly" feature looks great - it's a nice usability enhancement that will make the reading experience more seamless. Let me know if you need any further assistance with this PR!



---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

---

&lt;!-- This is an auto-generated comment: tweet message by coderabbit.ai --&gt;

If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Catch%20CSS%20bugs%20early!%20%40coderabbitai%20spotted%20a%20missing%20var()%20around%20a%20CSS%20variable%E2%80%94crucial%20for%20proper%20styling.%20Save%20time%20%26%20avoid%20errors%20with%20smart%20code%20reviews!%20%F0%9F%8E%AF%E2%9C%A8&url=https%3A%2F%2Fgithub.com%2FCoralPink%2Fcommentary%2Fpull%2F420%23discussion_r2063241718)?

Thank you for using CodeRabbit!

&lt;!-- end of auto-generated comment: tweet message by coderabbit.ai --&gt;

</answer></rawResChunk> -->

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-04-28T09:09:43Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
path: js/footnote.ts
user: login: CoralPink
body: This is something I have also noticed, but the operation to close the side menu (Esc key) also reacts with it, so the whole thing needs to be taken into consideration. For time reasons, I would like to pass on this issue at this time.

But we need a `setAttribute()`. Let's get it in right away.
created_at: 2025-04-28T09:21:49Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
path: js/footnote.ts
user: login: coderabbitai[bot]
body: @CoralPink Understood! Here's just the ARIA attributes implementation without the keyboard handling:

```javascript
const handleFootnoteClick = (target: EventTarget | null): void => {
  // ... existing code ...

  const tip = document.createElement('aside');
  tip.setAttribute('class', 'ft-pop');
  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
  tip.setAttribute('role', 'tooltip');
  tip.setAttribute('id', `popover-${href.slice(1)}`);
  
  // Connect the button to the popover for accessibility
  target.setAttribute('aria-expanded', 'true');
  target.setAttribute('aria-controls', `popover-${href.slice(1)}`);

  const onClickOutside = (ev: MouseEvent) => {
    // ... existing code ...
    
    if (!tip.contains(ev.target) && target !== ev.target) {
      closePopover(tip);
      document.removeEventListener('click', onClickOutside);
      target.setAttribute('aria-expanded', 'false');
      target.removeAttribute('aria-controls');
    }
  };

  // ... rest of existing code ...
};
```

This adds the necessary ARIA attributes without interfering with your current side menu's Escape key functionality.

---

<details>
<summary>✏️ Learnings added</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#420
File: js/footnote.ts:14-53
Timestamp: 2025-04-28T09:22:22.344Z
Learning: CoralPink prefers to prioritize partial accessibility improvements that don't conflict with existing functionality, and defer more comprehensive accessibility implementations to future PRs.
```

> Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings).

</details>



---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>




<!-- <agentComponentType>chat-answer</agentComponentType> -->

<!-- <rawResChunk><answer>@CoralPink Understood! Here's just the ARIA attributes implementation without the keyboard handling:

```javascript
const handleFootnoteClick = (target: EventTarget | null): void => {
  // ... existing code ...

  const tip = document.createElement('aside');
  tip.setAttribute('class', 'ft-pop');
  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
  tip.setAttribute('role', 'tooltip');
  tip.setAttribute('id', `popover-${href.slice(1)}`);
  
  // Connect the button to the popover for accessibility
  target.setAttribute('aria-expanded', 'true');
  target.setAttribute('aria-controls', `popover-${href.slice(1)}`);

  const onClickOutside = (ev: MouseEvent) => {
    // ... existing code ...
    
    if (!tip.contains(ev.target) && target !== ev.target) {
      closePopover(tip);
      document.removeEventListener('click', onClickOutside);
      target.setAttribute('aria-expanded', 'false');
      target.removeAttribute('aria-controls');
    }
  };

  // ... rest of existing code ...
};
```

This adds the necessary ARIA attributes without interfering with your current side menu's Escape key functionality.

---

<details>
<summary>✏️ Learnings added</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#420
File: js/footnote.ts:14-53
Timestamp: 2025-04-28T09:22:22.344Z
Learning: CoralPink prefers to prioritize partial accessibility improvements that don't conflict with existing functionality, and defer more comprehensive accessibility implementations to future PRs.
```

> Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings).

</details>



---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

</answer></rawResChunk> -->

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-04-28T09:22:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
path: js/footnote.ts
user: login: CoralPink
body: Thanks, that's helpful!
created_at: 2025-04-28T09:26:05Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
path: js/footnote.ts
user: login: coderabbitai[bot]
body: @CoralPink You're welcome! I'm glad the simplified ARIA implementation is helpful. Let me know if you need any other assistance with the footnote feature.



---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

---

<!-- This is an auto-generated comment: tweet message by coderabbit.ai -->

If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Boost%20your%20UI's%20accessibility%20by%20adding%20ARIA%20attributes%20to%20popovers%20without%20breaking%20existing%20keyboard%20shortcuts!%20%F0%9F%A6%BE%20Enhance%20UX%20with%20%40coderabbitai%E2%80%99s%20smart%2C%20conflict-free%20advice.%20Try%20it%20now!%20%F0%9F%9A%80&url=https%3A%2F%2Fgithub.com%2FCoralPink%2Fcommentary%2Fpull%2F420%23discussion_r2063241731)?

Thank you for using CodeRabbit!

<!-- end of auto-generated comment: tweet message by coderabbit.ai -->




<!-- <agentComponentType>chat-answer</agentComponentType> -->

<!-- <rawResChunk><answer>@CoralPink You're welcome! I'm glad the simplified ARIA implementation is helpful. Let me know if you need any other assistance with the footnote feature.



---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

---

&lt;!-- This is an auto-generated comment: tweet message by coderabbit.ai --&gt;

If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Boost%20your%20UI's%20accessibility%20by%20adding%20ARIA%20attributes%20to%20popovers%20without%20breaking%20existing%20keyboard%20shortcuts!%20%F0%9F%A6%BE%20Enhance%20UX%20with%20%40coderabbitai%E2%80%99s%20smart%2C%20conflict-free%20advice.%20Try%20it%20now!%20%F0%9F%9A%80&url=https%3A%2F%2Fgithub.com%2FCoralPink%2Fcommentary%2Fpull%2F420%23discussion_r2063241731)?

Thank you for using CodeRabbit!

&lt;!-- end of auto-generated comment: tweet message by coderabbit.ai --&gt;

</answer></rawResChunk> -->

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-04-28T09:26:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
+
+export const initFootnote = (): void => {
+  for (const sup of Array.from(document.querySelectorAll('sup.ft-reference'))) {
+    sup.addEventListener('click', ev => handleFootnoteClick(ev.target), { once: false, passive: true });
+  }
+};
path: js/footnote.ts
user: login: CoralPink
body: Currently it is only a `click` event, so I think it is fine as is.

So I will consider it at that time, along with the Esc key adjustment.
created_at: 2025-04-28T09:28:50Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,59 @@
+const closePopover = (tip: HTMLElement) => {
+  tip.classList.remove('show');
+
+  const handleTransitionEnd = (event: TransitionEvent) => {
+    if (event.propertyName === 'opacity') {
+      tip.removeEventListener('transitionend', handleTransitionEnd);
+      tip.remove();
+    }
+  };
+
+  tip.addEventListener('transitionend', handleTransitionEnd);
+};
+
+const handleFootnoteClick = (target: EventTarget | null): void => {
+  if (!(target instanceof HTMLElement)) {
+    return;
+  }
+
+  const href = target.getAttribute('data-href');
+
+  if (!href) {
+    return;
+  }
+
+  const footnote = document.getElementById(href.slice(1));
+
+  if (!footnote) {
+    return;
+  }
+
+  const tip = document.createElement('aside');
+  tip.setAttribute('class', 'ft-pop');
+  tip.insertAdjacentHTML('afterbegin', footnote.innerHTML);
+
+  const onClickOutside = (ev: MouseEvent) => {
+    if (!(ev.target instanceof Node)) {
+      return;
+    }
+
+    if (!tip.contains(ev.target) && target !== ev.target) {
+      closePopover(tip);
+      document.removeEventListener('click', onClickOutside);
+    }
+  };
+
+  target.appendChild(tip);
+
+  requestAnimationFrame(() => {
+    tip.classList.add('show');
+  });
+
+  document.addEventListener('click', onClickOutside, { once: false, passive: true });
+};
+
+export const initFootnote = (): void => {
+  for (const sup of Array.from(document.querySelectorAll('sup.ft-reference'))) {
+    sup.addEventListener('click', ev => handleFootnoteClick(ev.target), { once: false, passive: true });
+  }
+};
path: js/footnote.ts
user: login: coderabbitai[bot]
body: @CoralPink Understood! The current implementation works well for the basic functionality. Your approach of addressing enhancements like multiple popover management and Esc key functionality in a future PR makes sense. The footnote feature is already a nice addition to the user experience as is.

(⌒ ⌒)

---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>




<!-- <agentComponentType>chat-answer</agentComponentType> -->

<!-- <rawResChunk><answer>@CoralPink Understood! The current implementation works well for the basic functionality. Your approach of addressing enhancements like multiple popover management and Esc key functionality in a future PR makes sense. The footnote feature is already a nice addition to the user experience as is.

(⌒ ⌒)

---

<details>
<summary>🧠 Learnings used</summary>

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-10-08T15:42:47.459Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

---

```
Learnt from: CoralPink
PR: CoralPink/commentary#141
File: .github/workflows/gh-pages.yml:260-265
Timestamp: 2024-07-23T07:26:08.671Z
Learning: CoralPink prefers to defer certain changes and address them in future PRs when necessary.
```

</details>

</answer></rawResChunk> -->

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-04-28T09:29:17Z
author_association: CONTRIBUTOR

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-04-28T09:06:37Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough

This update introduces interactive footnote popovers to the webpage. A new JavaScript module implements the popover logic, and the main script is updated to initialize this functionality during page setup. The HTML structure for footnote references is changed from anchor tags to button elements, both in the Rust backend that generates HTML and in test files. Corresponding CSS is updated to style the new button-based references and the popover component. Additionally, version numbers are incremented in both the Rust package and the service worker cache.

## Changes

| File(s)                                               | Change Summary                                                                                                           |
|-------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| js/footnote.ts                                        | New module implementing interactive footnote popovers with event listeners, popover creation, and outside click handling.|
| js/book.ts                                            | Imports and initializes the new footnote popover logic in the page setup sequence.                                       |
| rs/mdbook-footnote/src/lib.rs, rs/mdbook-footnote/test/ok.md | Changes footnote reference markup from `<a>` to `<button>` with updated attributes in generated and test HTML.           |
| scss/_footnote.scss                                   | Updates styles for footnote references (now buttons), adds styles for the popover component, and adjusts selector syntax.|
| rs/mdbook-footnote/Cargo.toml                         | Increments Rust package version from 1.5.0 to 1.6.                                                                      |
| js/serviceworker.ts                                   | Updates cache version string from 'v7.1.1' to 'v7.2.0'.                                                                 |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User as User
    participant Browser as Browser (DOMContentLoaded)
    participant BookJS as book.ts
    participant FootnoteJS as footnote.ts
    participant DOM as Document

    User->>Browser: Loads page
    Browser->>BookJS: DOMContentLoaded event
    BookJS->>FootnoteJS: initFootnote()
    FootnoteJS->>DOM: Attach click listeners to .ft-reference <sup> elements

    User->>DOM: Clicks footnote button
    DOM->>FootnoteJS: handleFootnoteClick(target)
    FootnoteJS->>DOM: Find footnote content, create and show popover
    User->>DOM: Clicks outside popover
    DOM->>FootnoteJS: Close and remove popover after transition
```

## Poem

> In the garden of notes, a new pop appears,  
> Where buttons now bloom, replacing old snares.  
> A click brings a whisper, a footnote in flight,  
> Floating on pages, in gentle delight.  
> With styles refreshed and versions anew,  
> This bunny hops forward—interactive and true!  
> 🐇✨

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIANXgSAHdIADN8fFwMDI98LFxYDxSveUBeDcAPvYAaaPtsAWZ1Gno5SGxESkgAYXwqLyt4DABrdGRbSAxHAXaAFgAmAAYK9HhmZAJIMhVI1PTM7ORcsIL7dQ81ychaJG4vNFko2lkMNHqGNB9ZDRgjpUQGCnhuOIDv1Lq8aKtYNRDh5ltcSGwMLhqPADm8vPhEsg0hksuCwvhIOcJAlElF+jQqGJJCRipBEupYPg8GMSHR+kR8WM0MSiN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YVUVeQWyllIreUAC6S/BHM3xGyWU2zfELMWCm0N2VyzFV0/lVWABHFA0HysAfBJSRYHsvk5ASEMWLIekjWUQboXLIqUAscVYgvJEPENpJgdEeWIhcy0KSy6ZNirLdfYbdctAcMOhM1UySs3yoC7dRaK4G4O4cwvpWK9wNoNsiSMSBgmCqIBCmaQ1JMvUf/WgIQI3OAyWas4/GC+lBTM8zkEgglb6d3IMgIiA0Mr9CI0bSMhIybZI+MjjdIgkTIzkeI4opIkPEDaQahc64bINAAbnHXkA6D2z2ywRAtmnrIIGdjzWbK6V53sAnPcidwCyCoSGjNEitE2JTJwjwlPBcovDQDwCvBR1ghYBVC4CoGSEL1Y2aG/HQjUEwkAhxuAnvHqFwE2w7EQE2031rFoE21kgsSPAMBZoEAYGU1ihBwEFoEFwAGY6AGBxd2oBBxc5hxcABONAOYOYGWqYZTNWlW5TQXNWsWqYVQGYbCQwFmmYKYWKOxcXZvWgSNPWuWhgOYFIQXOxZTOxGYQXQXQ292mWw262uYNWqYBgG2i23G1m9QDm8Sbmk0EkOgTbM8fQIAA=== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=CoralPink/commentary&utm_content=420):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: CoralPink
created_at: 2025-04-28T10:07:13Z
body: I know it's not the most clever code or behavior, but we'll leave that for next time.

I think the behavior itself is more interesting than before.
Let's merge them!
author_association: OWNER