Skip to content

Frontend : Add right click menu in terminal#4465

Open
greedy-wudpeckr wants to merge 1 commit intokubernetes-sigs:mainfrom
greedy-wudpeckr:terminal-btns
Open

Frontend : Add right click menu in terminal#4465
greedy-wudpeckr wants to merge 1 commit intokubernetes-sigs:mainfrom
greedy-wudpeckr:terminal-btns

Conversation

@greedy-wudpeckr
Copy link
Contributor

Summary

  • This PR adds right click menu in terminal (e.g. copy/paste)

Related Issue

Preview

fixed-terminal.mov

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: greedy-wudpeckr
Once this PR has been reviewed and has the lgtm label, please assign joaquimrocha for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 27, 2026
@sniok
Copy link
Contributor

sniok commented Jan 27, 2026

in the current version there's already a context menu when you right click

image

so I'm not sure why we need this change?

@jimmyjones2
Copy link

@sniok On 0.39.0 installed using flatpak, there is no right click menu in terminals or logs

Copy link
Contributor

@skoeva skoeva left a comment

Choose a reason for hiding this comment

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

Hi! It looks like the translations are out of date, would be good to update those to get the CI to pass

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 28, 2026
@sniok
Copy link
Contributor

sniok commented Jan 28, 2026

I don't think we should replace default context menu everywhere just because it doesn't work on flatpak. We should look into what causes it not to work on flatpak and try to resolve that

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a right-click context menu to the terminal component, enabling users to copy and paste text directly from the terminal interface. This addresses issue #3797 by providing a more intuitive alternative to using the Edit menu for copy/paste operations.

Changes:

  • Added context menu with Copy and Paste options to the Terminal component
  • Added "Paste" translations across all 12 supported language files
  • Added the mdi:content-paste icon definition to support the new menu item

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

File Description
frontend/src/components/common/Terminal.tsx Implements the right-click context menu with copy/paste handlers and prevents default browser context menu
frontend/src/components/App/icons.ts Adds the content-paste icon definition for the paste menu item
frontend/src/i18n/locales/*/translation.json Adds "Paste" translation for all 12 supported languages (en, de, es, fr, hi, it, ja, ko, pt, ta, zh, zh-tw)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: greedy-wudpeckr <mudituiet@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 28, 2026
@illume
Copy link
Contributor

illume commented Jan 28, 2026

I don't think we should replace default context menu everywhere just because it doesn't work on flatpak. We should look into what causes it not to work on flatpak and try to resolve that

@greedy-wudpeckr I think it's a good idea to check if this is solvable by giving the flatpak build some more permissions? Or some other build configuration change?

I know Flatpak used to be quite broken when it came to many things like copy/paste and context menus... but I haven't really followed it closely for some years. If it's still broken, then I think we can adapt your code to only run when on Flatpak.

So yeah, let's check if there's permissions or build related fix first? Then if it's just broken, then we can add a config item that the Flatpak build sets to enable this custom context menu.

What do you think?

@jimmyjones2
Copy link

FWIW copy & paste menus and the copy buttons work fine in flatpak, but right click menus don't appear

@joaquimrocha
Copy link
Contributor

@sniok Did you try that in the app? I have just tried the app (npm run app:start:client) and I do not see the context menu. Seems like Electron doesn't have one by default.

If that's true and not just an artifact of my environment (running on Linux but not flatpak), then I would suggest that we go with this menu just in app-mode (using it with isElectron).

WDYT?

@illume illume added this to the v0.40.0 milestone Feb 2, 2026
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 3, 2026
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@sniok
Copy link
Contributor

sniok commented Feb 3, 2026

Since context menu is only needed in app, this new context menu should only be in the 'app' mode. @jimmyjones2 could you add a isElectron() check?

@illume illume modified the milestones: v0.40.0, v0.41.0 Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add right click menu in terminal (e.g. copy/paste)

7 participants