Skip to content

clean-conversation-headers - head ref is mistakenly highlighted #9952

Closed

Description

@fregante

Description

Image

This is only the visible part of the bug, but I'm sure there are more issues due to it. Problematic part:

const base = $('[class^="PullRequestBranchName"]', summaryRow);

How to replicate the issue + URL

  1. Visit open PR
  2. click "Edit title" before RGH loads
  3. The feature will not find the base tag element and assume that the head tag element is what it's looking for

Extension version

26.8.8

Browser(s) used

safari

Token ⚠️

  • I set a token in the options page. I understand that some features require a token to work.

Activity

  1. added
    small
    on Aug 8, 2026
  2. Sebastien-Ahkrin commented on Aug 8, 2026

    @Sebastien-Ahkrin
    Contributor

    Both a href are like this :

    E.g from this PR

    First element with the PullRequestBranchName selector

    <a href="/refined-github/refined-github/tree/main" aria-describedby="_R_asn2pk5_" class="PullRequestBranchName-module__branchName__SCtl2 prc-BranchName-BranchName-CMTaU rgh-base-branch" data-component="BranchName"><span class="sr-only">refined-github:</span>main</a>

    Second element with the PullRequestBranchName selector

    <a href="/Sebastien-Ahkrin/refined-github/tree/main" aria-describedby="_R_1qsn2pk5_" class="PullRequestBranchName-module__branchName__SCtl2 prc-BranchName-BranchName-CMTaU" data-component="BranchName">Sebastien-Ahkrin:main</a>
    

    Two diff, only first element use rgh-base-branch Set by us

    base.classList.add('rgh-base-branch');

    So we cannot use it. And the second diff is that the first element are pointing to /refined-github/refined-github/tree/main. I think we can use it for the selector BUT this will only work for external pull request. PR from this repository will point to refined-github/refined-github Too ..

    I think a good fix would be to not rely on picking the first match until we're sure both elements are present in the DOM (wait for ('[class^="PullRequestBranchName"]', summaryRow) to return 2 elements) before assuming the first one is the base. I think, this can fix the bug

    Let me know if that approach sounds right. Happy to open a new PR once we agree on the direction

  3. fregante commented on Aug 8, 2026

    @fregante
    MemberAuthor

    That's acceptable, but I think this can be achieved via the existing observer itself. It can target the second branch using selector like header ref ~ ref.

    Note that untested AI PRs are not welcome so if you do open a PR make sure it includes a gif/video of it working.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedbugsmall

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions