Skip to content

jump-to-conversation-close-event - Restore on issues#9477

Open
lloyd-c137 wants to merge 3 commits into
refined-github:mainfrom
lloyd-c137:fix/jump-to-close-event-new-issues
Open

jump-to-conversation-close-event - Restore on issues#9477
lloyd-c137 wants to merge 3 commits into
refined-github:mainfrom
lloyd-c137:fix/jump-to-close-event-new-issues

Conversation

@lloyd-c137
Copy link
Copy Markdown

Summary

Fixes #9455.

GitHub rolled out a new React-based Issues page UI that uses CSS module class names. The old selector [data-timeline-event-id]:has([data-testid="state-reason-link"]) no longer matches any element.

The new Issues UI renders close events as a <ClosedEvent> React component with a closing link that has a CSS module class starting with ClosedEvent-module__closerLink (confirmable via the existing same-page-links.tsx selector).

Changes

source/github-helpers/selectors.ts

  • Added a[class^="ClosedEvent-module__closerLink"] to conversationCloseEvent to detect the close event in the new Issues React view

source/features/jump-to-conversation-close-event.tsx

  • When the matched element is itself an <a> tag (new React UI), use it directly as eventAnchor
  • When it is a wrapper element (old UI), find the child link as before

Test URLs (new UI)

Test URLs (old UI — still works)

Validation

  • npx tsc --noEmit
  • npx eslint source/features/jump-to-conversation-close-event.tsx ✅ (0 errors)
  • npm run build:bundle

…github#9455)

GitHub updated its Issues page UI to use React components with CSS module
classes. The old selector targeting `[data-timeline-event-id]:has([data-testid=state-reason-link])` no longer matches the new DOM structure.

Changes:
- selectors.ts: Added `a[class^=ClosedEvent-module__closerLink]` selector for the new Issues React view
- jump-to-conversation-close-event.tsx: Handle when the close event element IS the anchor link directly (new UI) vs a wrapper element (old UI)
@github-actions github-actions Bot added the bug label May 16, 2026
@lloyd-c137
Copy link
Copy Markdown
Author

I have tested this on the test URLs listed in the issue. The feature now works on both the new React Issues UI (#9455) and the old timeline view (sandbox PRs/Issues). Happy to make adjustments if the maintainers have feedback on the approach.

Copy link
Copy Markdown
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

Can you record a video of this working? There's a free app called LICEcap on Windows and Mac to record short gifs

// `lastCloseEvent` is a wrapper element in old views, but a direct `<a>` link in the new React Issues UI
const eventAnchor = lastCloseEvent?.tagName === 'A'
? lastCloseEvent as HTMLAnchorElement
: $('a[href*="#event-"]', lastCloseEvent);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This shouldn't be necessary. a.closest('a') will already match itself

@fregante fregante changed the title Fix jump-to-conversation-close-event on new React Issues UI jump-to-conversation-close-event - Restore on issues May 16, 2026
@lloyd-c137
Copy link
Copy Markdown
Author

Good point - closest("a") is much cleaner. Updated in a4b6e3d.

As for the video, I do not have a screen recording tool on this machine, but the test URLs in the original issue (closed issues on the sandbox repo) can verify the fix:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

jump-to-conversation-close-event broken on new issues

2 participants