Skip to content

fix: remove duplicate IDs #35210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean code
  • Loading branch information
kerwin612 committed Aug 9, 2025
commit 886f5465d2bd9ac53ad8524f4f82c71808ea0f7e
25 changes: 12 additions & 13 deletions web_src/js/features/repo-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ function showLineButton() {
el.remove();
}

// Find first active row and add button
const activeRows = document.querySelectorAll('.code-view tr.active');
if (activeRows.length === 0) return;
// find active row and add button
const tr = document.querySelector('.code-view tr.active');
if (!tr) return;

const firstActiveRow = activeRows[0];
const td = firstActiveRow.querySelector('td.lines-num');
const td = tr.querySelector('td.lines-num');
const btn = document.createElement('button');
btn.classList.add('code-line-button', 'ui', 'basic', 'button');
btn.innerHTML = svg('octicon-kebab-horizontal');
Expand All @@ -97,28 +96,28 @@ function showLineButton() {

createTippy(btn, {
theme: 'menu',
trigger: 'manual', // Use manual trigger
trigger: 'click',
hideOnClick: true,
content: menu,
placement: 'right-start',
interactive: true,
appendTo: () => document.body,
onShow: (tippy) => {
tippy.popper.addEventListener('click', () => {
tippy.hide();
}, {once: true});
},
});

// Handle menu button click manually
btn.addEventListener('click', (e) => {
e.stopPropagation();
const tippyInstance = btn._tippy;
if (tippyInstance?.state.isVisible) {
if (tippyInstance?.state.isShown) {
tippyInstance.hide();
} else if (tippyInstance) {
tippyInstance.show();
}
});

// Hide menu when clicking menu items
menu.addEventListener('click', () => {
btn._tippy?.hide();
});
}

export function initRepoCodeView() {
Expand Down