aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/common-global.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/features/common-global.js')
-rw-r--r--web_src/js/features/common-global.js35
1 files changed, 23 insertions, 12 deletions
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index 0f36ce2bf8..cdb9132805 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -89,9 +89,14 @@ export function initGlobalCommon() {
// Semantic UI modules.
const $uiDropdowns = $('.ui.dropdown');
- $uiDropdowns.filter(':not(.custom)').dropdown({
- fullTextSearch: 'exact'
- });
+
+ // do not init "custom" dropdowns, "custom" dropdowns are managed by their own code.
+ $uiDropdowns.filter(':not(.custom)').dropdown({fullTextSearch: 'exact'});
+
+ // The "jump" means this dropdown is mainly used for "menu" purpose,
+ // clicking an item will jump to somewhere else or trigger an action/function.
+ // When a dropdown is used for non-refresh actions with tippy,
+ // it must have this "jump" class to hide the tippy when dropdown is closed.
$uiDropdowns.filter('.jump').dropdown({
action: 'hide',
onShow() {
@@ -101,17 +106,23 @@ export function initGlobalCommon() {
},
onHide() {
this._tippy?.enable();
+
+ // hide all tippy elements of items after a while. eg: use Enter to click "Copy Link" in the Issue Context Menu
+ setTimeout(() => {
+ const $dropdown = $(this);
+ if ($dropdown.dropdown('is hidden')) {
+ $(this).find('.menu > .item').each((_, item) => {
+ item._tippy?.hide();
+ });
+ }
+ }, 2000);
},
- fullTextSearch: 'exact'
- });
- $uiDropdowns.filter('.slide.up').dropdown({
- transition: 'slide up',
- fullTextSearch: 'exact'
- });
- $uiDropdowns.filter('.upward').dropdown({
- direction: 'upward',
- fullTextSearch: 'exact'
});
+
+ // special animations/popup-directions
+ $uiDropdowns.filter('.slide.up').dropdown({transition: 'slide up'});
+ $uiDropdowns.filter('.upward').dropdown({direction: 'upward'});
+
attachDropdownAria($uiDropdowns);
attachCheckboxAria($('.ui.checkbox'));