Skip to content

ui fix for Selected repos#529

Open
JaYRaNa213 wants to merge 1 commit intofossasia:mainfrom
JaYRaNa213:ui/fix-selected-repos-overflow
Open

ui fix for Selected repos#529
JaYRaNa213 wants to merge 1 commit intofossasia:mainfrom
JaYRaNa213:ui/fix-selected-repos-overflow

Conversation

@JaYRaNa213
Copy link
Copy Markdown

@JaYRaNa213 JaYRaNa213 commented Apr 11, 2026

📌 Fixes

Fixes #528


📝 Summary of Changes

  • Fixed UI overflow issue in the selected repositories section
  • Added max-width and truncation to repository tags to handle long names
  • Improved layout using proper flex wrapping and spacing
  • Added vertical scroll support when multiple repositories are selected
  • Ensured remove (X) button remains visible and aligned

📸 Screenshots / Demo (if UI-related)

Before:

Long repository names overflow outside the container
Layout breaks when multiple repositories are selected

Capture2

After:

Tags are properly contained within the UI
Long names are truncated with ellipsis (...)
Clean wrapping and scroll behavior for multiple selections
image


✅ Checklist

  • I’ve tested my changes locally
  • I’ve added tests (if applicable)
  • I’ve updated documentation (if applicable)
  • My code follows the project’s code style guidelines

👀 Reviewer Notes

This fix improves the usability and visual consistency of the repository filter UI.
The changes ensure the layout remains stable even with long repository names or a large number of selected repositories.

Summary by Sourcery

Improve the selected repositories UI to handle long names and multiple selections without layout issues.

Enhancements:

  • Constrain and truncate repository tags in the selected repositories list to prevent overflow and keep remove buttons visible.
  • Adjust spacing and flex layout of repository tags for cleaner wrapping and alignment.
  • Add a maximum height with vertical scrolling to the selected repositories container for better handling of many selections.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Apr 11, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the UI layout and styling for the selected repositories chip list to better handle long repository names and many selections, adding truncation, max-width, spacing tweaks, and scroll behavior while keeping the remove button visible and aligned.

Flow diagram for updated selectedRepos and repoTags layout structure

flowchart TD
  A[selectedRepos_container]
  B[repoTags_flex_wrapper]
  C[repoPlaceholder_text]
  D[repoTag_chip_span]
  E[inner_truncate_span]
  F[remove_repo_button]
  G[remove_icon]

  A --> B
  B --> C
  B --> D
  D --> E
  D --> F
  F --> G

  A:::selectedRepos
  B:::repoTags
  D:::chip
  E:::truncate
  F:::removeBtn

  classDef selectedRepos fill:#e5e7eb,stroke:#9ca3af,stroke-width:1px
  classDef repoTags fill:#f3f4f6,stroke:#d1d5db,stroke-width:1px
  classDef chip fill:#dbeafe,stroke:#60a5fa,stroke-width:1px
  classDef truncate fill:#ffffff,stroke:#93c5fd,stroke-width:1px,stroke-dasharray:3 3
  classDef removeBtn fill:#eff6ff,stroke:#3b82f6,stroke-width:1px
Loading

File-Level Changes

Change Details Files
Refine rendering of selected repository tags to constrain width, truncate long names, and keep the remove button visible.
  • Change each selected repo tag from an inline-flex pill to a flex container with max width for better wrapping and alignment.
  • Wrap the repository name in a truncating span so long names are ellipsized instead of overflowing.
  • Ensure the remove (X) button does not shrink by adding flex-shrink-0 and keeping cursor and hover styles.
src/scripts/popup.js
Update the selected repositories container to support vertical scrolling and improved wrapping/spacing of tags while cleaning up placeholder text formatting.
  • Add a max height and vertical overflow scrolling to the selected repos container to handle many selections.
  • Adjust the repo tags wrapper flex gap for more consistent spacing between tags.
  • Reformat the placeholder text span so the i18n key covers the whole phrase and whitespace is cleaned up.
src/popup.html

Assessment against linked issues

Issue Objective Addressed Explanation
#528 Ensure selected repository tags do not overflow the layout by constraining tag width, wrapping tags within the container, and truncating long repository names with ellipsis.
#528 Ensure the selected repositories container handles many selected tags gracefully (e.g., via scrolling) so the UI remains clean and readable.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added javascript Pull requests that update javascript code frontend extension labels Apr 11, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 2 security issues, 1 other issue, and left some high level feedback:

Security issues:

  • User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities (link)
  • User controlled data in a repoTags.innerHTML is an anti-pattern that can lead to XSS vulnerabilities (link)

General comments:

  • Consider adding a title="${repoFullName}" (or similar) to the truncated repo name span so users can still access the full repository name on hover and for accessibility.
  • The hardcoded max-w-[120px] on the repo tag may be too restrictive for some layouts; consider making this width responsive or based on the container (e.g., percentage or breakpoint-based classes) to better adapt to different popup sizes.
  • The HTML generated in the template literal has indentation and spacing that differs from the surrounding code style in popup.js; aligning it with the existing formatting will keep the markup easier to read and maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding a `title="${repoFullName}"` (or similar) to the truncated repo name span so users can still access the full repository name on hover and for accessibility.
- The hardcoded `max-w-[120px]` on the repo tag may be too restrictive for some layouts; consider making this width responsive or based on the container (e.g., percentage or breakpoint-based classes) to better adapt to different popup sizes.
- The HTML generated in the template literal has indentation and spacing that differs from the surrounding code style in `popup.js`; aligning it with the existing formatting will keep the markup easier to read and maintain.

## Individual Comments

### Comment 1
<location path="src/scripts/popup.js" line_range="1555-1563" />
<code_context>
-                            </button>
-                        </span>
-                    `;
+            <span class="flex items-center max-w-[120px] px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full m-1">
+              <span class="truncate">${repoName}</span>
+              <button 
+                type="button" 
</code_context>
<issue_to_address>
**suggestion:** Consider exposing the full repository name via a title or similar attribute to mitigate aggressive truncation.

Because of `max-w-[120px]` and `truncate`, many repo names will be ellipsized with no way to see the full value. Please add a `title="${repoFullName}"` to the outer span or the inner truncated span so the complete name remains available on hover and to assistive technologies.

```suggestion
            <span 
              class="flex items-center max-w-[120px] px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full m-1"
              title="${repoFullName}"
            >
              <span class="truncate">${repoName}</span>
              <button 
                type="button" 
                class="ml-1 text-blue-600 hover:text-blue-800 remove-repo-btn flex-shrink-0 cursor-pointer" 
                data-repo-name="${repoFullName}">
                  <i class="fa fa-times"></i>
              </button>
            </span>
```
</issue_to_address>

### Comment 2
<location path="src/scripts/popup.js" line_range="1552-1566" />
<code_context>
				repoTags.innerHTML = selectedRepos
					.map((repoFullName) => {
						const repoName = repoFullName.split('/')[1] || repoFullName;
						return `
            <span class="flex items-center max-w-[120px] px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full m-1">
              <span class="truncate">${repoName}</span>
              <button 
                type="button" 
                class="ml-1 text-blue-600 hover:text-blue-800 remove-repo-btn flex-shrink-0 cursor-pointer" 
                data-repo-name="${repoFullName}">
                  <i class="fa fa-times"></i>
              </button>
            </span>
          `;
					})
					.join(' ');
</code_context>
<issue_to_address>
**security (javascript.browser.security.insecure-document-method):** User controlled data in methods like `innerHTML`, `outerHTML` or `document.write` is an anti-pattern that can lead to XSS vulnerabilities

*Source: opengrep*
</issue_to_address>

### Comment 3
<location path="src/scripts/popup.js" line_range="1552-1566" />
<code_context>
				repoTags.innerHTML = selectedRepos
					.map((repoFullName) => {
						const repoName = repoFullName.split('/')[1] || repoFullName;
						return `
            <span class="flex items-center max-w-[120px] px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full m-1">
              <span class="truncate">${repoName}</span>
              <button 
                type="button" 
                class="ml-1 text-blue-600 hover:text-blue-800 remove-repo-btn flex-shrink-0 cursor-pointer" 
                data-repo-name="${repoFullName}">
                  <i class="fa fa-times"></i>
              </button>
            </span>
          `;
					})
					.join(' ');
</code_context>
<issue_to_address>
**security (javascript.browser.security.insecure-innerhtml):** User controlled data in a `repoTags.innerHTML` is an anti-pattern that can lead to XSS vulnerabilities

*Source: opengrep*
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/scripts/popup.js
Comment thread src/scripts/popup.js
Comment thread src/scripts/popup.js
@JaYRaNa213
Copy link
Copy Markdown
Author

@mariobehling sir
please review

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

Labels

extension frontend javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Ui fix for selected repos

1 participant