Skip to content

fix: improve minimap behavior for multi-span highlights#92

Merged
cuspymd merged 2 commits intomainfrom
fix/minimap-multi-span-emphasis
Apr 5, 2026
Merged

fix: improve minimap behavior for multi-span highlights#92
cuspymd merged 2 commits intomainfrom
fix/minimap-multi-span-emphasis

Conversation

@cuspymd
Copy link
Copy Markdown
Owner

@cuspymd cuspymd commented Apr 5, 2026

Summary

  • emphasize all spans in a highlight group when clicking a minimap marker
  • build minimap tooltip text from the full multi-span highlight group instead of only the representative span
  • keep existing minimap scrolling behavior while improving multi-span highlight feedback

Testing

  • npm test -- --runInBand
  • npx playwright test

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 010295dd2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


const groupId = highlightElement.dataset.groupId;
const highlightElements = groupId
? Array.from(document.querySelectorAll(`.text-highlighter-extension[data-group-id='${groupId}']`))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Escape groupId before querySelectorAll selector interpolation

groupId is inserted raw into an attribute selector here, so a valid imported ID containing selector metacharacters (for example ' or ]) will cause querySelectorAll(...) to throw a SyntaxError and abort updateMarkers(), which leaves the minimap broken for that page. This is reachable because highlight import currently accepts any non-empty string for groupId; use CSS.escape(groupId) (or a non-selector lookup) before building the selector (and apply the same fix to the identical pattern in highlightTemporarily).

Useful? React with 👍 / 👎.

@cuspymd cuspymd merged commit d5fad94 into main Apr 5, 2026
2 of 3 checks passed
@cuspymd cuspymd deleted the fix/minimap-multi-span-emphasis branch April 5, 2026 14:11
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