aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/modules
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-10-18 17:16:06 +0200
committerGitHub <noreply@github.com>2023-10-18 15:16:06 +0000
commit0b654fa8dc132cce191f43fb9bdf4d5864e11b7c (patch)
tree2550ccfec53c0da4395dfd7ef704e6bd8b2ffff7 /web_src/js/modules
parent9852c92e9a633fdd318fde5014a12ef299b990ef (diff)
downloadgitea-0b654fa8dc132cce191f43fb9bdf4d5864e11b7c.tar.gz
gitea-0b654fa8dc132cce191f43fb9bdf4d5864e11b7c.zip
Clipboard copy enhancements (#27669)
1. Do not show temporary tooltips that are triggered from within dropdowns. Previously this resulted in the tooltip being stuck to top-left of the page like seen on issue comment URL copy. I could not figure out any tippy options that prevent this, so I think it's better to just not show it. 1. Refactor `initGlobalCopyToClipboardListener` so that it does not run a often useless `document.querySelector` on every click, make `data-clipboard-text-type` work with `data-clipboard-target`. No use in current code base but still good to have. Finally some minor code cleanup in the function. Point 1 is for this copy button: <img width="229" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/81f34746-8ea5-43d9-8c6f-f6f417a9e4ad"> --------- Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js/modules')
-rw-r--r--web_src/js/modules/tippy.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js
index 372f7bc8f3..4eed0aa4bb 100644
--- a/web_src/js/modules/tippy.js
+++ b/web_src/js/modules/tippy.js
@@ -169,6 +169,11 @@ export function initGlobalTooltips() {
}
export function showTemporaryTooltip(target, content) {
+ // if the target is inside a dropdown, don't show the tooltip because when the dropdown
+ // closes, the tippy would be pushed unsightly to the top-left of the screen like seen
+ // on the issue comment menu.
+ if (target.closest('.ui.dropdown > .menu')) return;
+
const tippy = target._tippy ?? attachTooltip(target, content);
tippy.setContent(content);
if (!tippy.state.isShown) tippy.show();