Skip to content

fix: show no tooltip for text the reserved system author holds - #141

Merged
JohnMcLear merged 2 commits into
mainfrom
fix/system-author-no-tooltip
Aug 5, 2026
Merged

fix: show no tooltip for text the reserved system author holds#141
JohnMcLear merged 2 commits into
mainfrom
fix/system-author-no-tooltip

Conversation

@JohnMcLear

Copy link
Copy Markdown
Member

Follow-up to ether/etherpad#8044 / ether/etherpad#8090, on the plugin side.

Problem

a.etherpad-system is the reserved id Etherpad attributes inserts to when no real author made them: the default pad content written on pad creation, HTTP API setText/appendText/setHTML without an authorId, and server-side imports. It's changeset bookkeeping, not a contributor — core ships no globalAuthor: record for it and filters it out of historicalAuthorData and listAuthorsOfPad.

So hovering the welcome text on any fresh pad fell through every lookup (not me → not in the user list → not in historicalAuthorData) and landed on the "Unknown Author" fallback. Verified in a browser before the fix — the tooltip reads UNKNOWN AUTHOR.

Fix

Return early in show() when the hovered span belongs to the system author. Nobody wrote that text, so no tooltip is better than naming an unknown someone.

Tests

Two new Playwright specs:

  • a tooltip still appears over your own writing (guards against the early return being too broad);
  • no tooltip appears over system-authored text.

The second one fails on the pre-fix build with Received: "UNKNOWN AUTHOR" and passes after. Both were run against a local Etherpad with this branch installed — 4/4 green.

🤖 Generated with Claude Code

Etherpad attributes inserts to `a.etherpad-system` when no real author made
them — the default pad content written on pad creation, HTTP API
setText/appendText/setHTML calls without an authorId, server-side imports.
Core deliberately ships no `globalAuthor:` record for it and keeps it out of
`historicalAuthorData` and `listAuthorsOfPad` (ether/etherpad#8044), so
hovering over the welcome text fell all the way through to the "Unknown
Author" fallback.

Nobody wrote that text, so show nothing rather than claiming an unknown
someone did.

Adds Playwright coverage for both sides: a tooltip still appears over your
own writing, and none appears over system-authored text. The latter fails on
the pre-fix build with "UNKNOWN AUTHOR".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Aug 4, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Stale tooltip not cleared ✓ Resolved 🐞 Bug ≡ Correctness
Description
showAuthor.show() returns early for the system author before calling showAuthor.destroy(), so an
already-visible tooltip from a previous hover can remain on screen while hovering system-authored
text. This is a PR-introduced behavior change that can briefly display the wrong author tooltip
until the existing fade-out completes.
Code

static/js/index.js[R57-60]

    const authorId = showAuthor.authorIdFromClass(authorTarget.className); // Get the authorId
    if (!authorId) { return; } // Default text isn't shown
+      if (authorId === SYSTEM_AUTHOR_ID) { return; } // Not written by anyone
    showAuthor.destroy(); // Destroy existing
Evidence
The new system-author early return is placed before the existing cleanup call, so this path skips
tooltip removal. The tooltip removal logic is otherwise delayed (fade-out), so an existing tooltip
can linger until its timeout completes.

static/js/index.js[53-64]
static/js/index.js[146-154]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When hovering system-authored spans, `showAuthor.show()` returns before calling `showAuthor.destroy()`. If a tooltip is already visible (from a prior hover), it can remain visible while the pointer is over system text, briefly showing a misleading author.
## Issue Context
Tooltips are removed asynchronously via a delayed fade-out, so skipping `destroy()` on the system-author path can leave a stale tooltip on screen.
## Fix Focus Areas
- static/js/index.js[53-64]
- static/js/index.js[146-154]
## Suggested change
Move `showAuthor.destroy()` earlier (before the system-author check), or explicitly call `showAuthor.destroy()` immediately before `return` in the `authorId === SYSTEM_AUTHOR_ID` branch so any existing tooltip is cleared when entering system-authored text.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Stale tooltip not cleared ✓ Resolved 🐞 Bug ≡ Correctness
Description
showAuthor.show() returns early for the system author before calling showAuthor.destroy(), so an
already-visible tooltip from a previous hover can remain on screen while hovering system-authored
text. This is a PR-introduced behavior change that can briefly display the wrong author tooltip
until the existing fade-out completes.
Code

static/js/index.js[R57-60]

     const authorId = showAuthor.authorIdFromClass(authorTarget.className); // Get the authorId
     if (!authorId) { return; } // Default text isn't shown
+      if (authorId === SYSTEM_AUTHOR_ID) { return; } // Not written by anyone
     showAuthor.destroy(); // Destroy existing
Evidence
The new system-author early return is placed before the existing cleanup call, so this path skips
tooltip removal. The tooltip removal logic is otherwise delayed (fade-out), so an existing tooltip
can linger until its timeout completes.

static/js/index.js[53-64]
static/js/index.js[146-154]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When hovering system-authored spans, `showAuthor.show()` returns before calling `showAuthor.destroy()`. If a tooltip is already visible (from a prior hover), it can remain visible while the pointer is over system text, briefly showing a misleading author.
## Issue Context
Tooltips are removed asynchronously via a delayed fade-out, so skipping `destroy()` on the system-author path can leave a stale tooltip on screen.
## Fix Focus Areas
- static/js/index.js[53-64]
- static/js/index.js[146-154]
## Suggested change
Move `showAuthor.destroy()` earlier (before the system-author check), or explicitly call `showAuthor.destroy()` immediately before `return` in the `authorId === SYSTEM_AUTHOR_ID` branch so any existing tooltip is cleared when entering system-authored text.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Aug 4, 2026

Copy link
Copy Markdown

PR Summary by Qodo

Fix: suppress author tooltip for Etherpad system-authored text

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Skip rendering the author tooltip when hovered text is attributed to a.etherpad-system.
• Prevent the welcome/default pad text from falling back to the “Unknown Author” tooltip.
• Add Playwright coverage for both “my text shows tooltip” and “system text shows none”.
Diagram

graph TD
  A[Mouse hover on span] --> B["showAuthor.show()"] --> C["authorIdFromClass()"] --> D{System author?}
  D -- "Yes (a.etherpad-system)" --> E[Return: no tooltip]
  D -- No --> F["authorNameAndColorFromAuthorId()"] --> G[Draw .authortooltip]
  H[Playwright specs] --> I[Hover target span] --> J[Assert tooltip present/absent]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Map system author to a friendly label (e.g., “System”)
  • ➕ Avoids a silent no-op by showing an explicit non-user source.
  • ➕ Keeps UX consistent: hover always yields some tooltip.
  • ➖ Risks implying a real author identity where Etherpad core intentionally provides none.
  • ➖ May reintroduce disagreement with core behavior (core filters this id from author lists).
2. Handle system author inside authorNameAndColorFromAuthorId()
  • ➕ Centralizes authorId special-casing in the resolver instead of the UI entry point.
  • ➕ Could also address other future reserved/unknown ids consistently.
  • ➖ Still requires a UX decision (return null vs label), and may complicate a resolver that currently always returns a fallback.

Recommendation: The PR’s early-return in showAuthor.show() is the most aligned with Etherpad core’s intent: a.etherpad-system is bookkeeping, not a contributor, so the best UX is “no tooltip” rather than an “Unknown Author” fallback. The added Playwright coverage appropriately guards against overly broad suppression (your text still shows a tooltip) while locking in the no-tooltip behavior for system-attributed content.

Files changed (2) +48 / -1

Bug fix (1) +10 / -0
index.jsSkip hover tooltip rendering for the reserved system author id +10/-0

Skip hover tooltip rendering for the reserved system author id

• Introduces a 'SYSTEM_AUTHOR_ID' constant for 'a.etherpad-system' and adds an early return in 'showAuthor.show()' when hovered text belongs to that author. This prevents default/system-attributed text from displaying the “Unknown Author” tooltip.

static/js/index.js

Tests (1) +38 / -1
author_hover.spec.tsAdd Playwright specs for tooltip presence (user text) and absence (system text) +38/-1

Add Playwright specs for tooltip presence (user text) and absence (system text)

• Expands the author-hover E2E suite with a polling helper to detect tooltips reliably given delayed rendering and fade-out behavior. Adds tests asserting a tooltip appears for the current user’s writing and no tooltip appears for system-authored default pad text.

static/tests/frontend-new/specs/author_hover.spec.ts

@qodo-code-review

qodo-code-review Bot commented Aug 4, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Stale tooltip not cleared ✓ Resolved 🐞 Bug ≡ Correctness
Description
showAuthor.show() returns early for the system author before calling showAuthor.destroy(), so an
already-visible tooltip from a previous hover can remain on screen while hovering system-authored
text. This is a PR-introduced behavior change that can briefly display the wrong author tooltip
until the existing fade-out completes.
Code

static/js/index.js[R57-60]

      const authorId = showAuthor.authorIdFromClass(authorTarget.className); // Get the authorId
      if (!authorId) { return; } // Default text isn't shown
+      if (authorId === SYSTEM_AUTHOR_ID) { return; } // Not written by anyone
      showAuthor.destroy(); // Destroy existing
Evidence
The new system-author early return is placed before the existing cleanup call, so this path skips
tooltip removal. The tooltip removal logic is otherwise delayed (fade-out), so an existing tooltip
can linger until its timeout completes.

static/js/index.js[53-64]
static/js/index.js[146-154]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When hovering system-authored spans, `showAuthor.show()` returns before calling `showAuthor.destroy()`. If a tooltip is already visible (from a prior hover), it can remain visible while the pointer is over system text, briefly showing a misleading author.

## Issue Context
Tooltips are removed asynchronously via a delayed fade-out, so skipping `destroy()` on the system-author path can leave a stale tooltip on screen.

## Fix Focus Areas
- static/js/index.js[53-64]
- static/js/index.js[146-154]

## Suggested change
Move `showAuthor.destroy()` earlier (before the system-author check), or explicitly call `showAuthor.destroy()` immediately before `return` in the `authorId === SYSTEM_AUTHOR_ID` branch so any existing tooltip is cleared when entering system-authored text.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread static/js/index.js
Review catch: the early return skipped showAuthor.destroy(), and tooltips
stay on screen for ~1.2s while they fade, so moving the pointer from a real
author's text onto system-authored text could leave the previous author's
label visible over text nobody wrote.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JohnMcLear
JohnMcLear merged commit 3a7ecd6 into main Aug 5, 2026
3 checks passed
@JohnMcLear
JohnMcLear deleted the fix/system-author-no-tooltip branch August 5, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant