Skip to content

Commit c208669

Browse files
committed
fix incorrect dropdown init and fix incorrect visible detection
1 parent 47b7811 commit c208669

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

templates/repo/issue/view_content/add_reaction.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{if .ctxData.IsSigned}}
2-
<div class="item action ui pointing select-reaction dropdown top right" data-action-url="{{.ActionURL}}">
2+
<div class="item action ui dropdown jump pointing top right select-reaction" data-action-url="{{.ActionURL}}">
33
<a class="add-reaction">
44
{{svg "octicon-smiley"}}
55
</a>

templates/repo/issue/view_content/context_menu.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{if .ctxData.IsSigned}}
2-
<div class="item action ui pointing custom dropdown top right context-dropdown">
2+
<div class="item action ui dropdown jump pointing top right context-dropdown">
33
<a class="context-menu">
44
{{svg "octicon-kebab-horizontal"}}
55
</a>

web_src/js/features/aria.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function attachOneDropdownAria($dropdown) {
7777
'aria-expanded': 'false',
7878
});
7979

80-
const isMenuVisible = () => $menu.hasClass('visible') || $menu.is('.animating.in');
80+
const isMenuVisible = () => $menu.hasClass('visible') && !$menu.hasClass('out'); // when hiding, it has class: ".animating.out"
8181

8282
// update aria attributes according to current active/selected item
8383
const refreshAria = () => {

web_src/js/features/common-global.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,12 @@ export function initGlobalCommon() {
8989

9090
// Semantic UI modules.
9191
const $uiDropdowns = $('.ui.dropdown');
92-
$uiDropdowns.filter(':not(.custom)').dropdown({
93-
fullTextSearch: 'exact'
94-
});
92+
93+
// do not init "custom" dropdowns, "custom" dropdowns are managed by their own code.
94+
$uiDropdowns.filter(':not(.custom)').dropdown({fullTextSearch: 'exact'});
95+
96+
// "jump" means this dropdown is mainly used for "menu" purpose, clicking an item will jump to somewhere else or trigger an action/function.
97+
// 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.
9598
$uiDropdowns.filter('.jump').dropdown({
9699
action: 'hide',
97100
onShow() {
@@ -102,16 +105,12 @@ export function initGlobalCommon() {
102105
onHide() {
103106
this._tippy?.enable();
104107
},
105-
fullTextSearch: 'exact'
106-
});
107-
$uiDropdowns.filter('.slide.up').dropdown({
108-
transition: 'slide up',
109-
fullTextSearch: 'exact'
110-
});
111-
$uiDropdowns.filter('.upward').dropdown({
112-
direction: 'upward',
113-
fullTextSearch: 'exact'
114108
});
109+
110+
// special animations/popup-directions
111+
$uiDropdowns.filter('.slide.up').dropdown({transition: 'slide up'});
112+
$uiDropdowns.filter('.upward').dropdown({direction: 'upward'});
113+
115114
attachDropdownAria($uiDropdowns);
116115

117116
attachCheckboxAria($('.ui.checkbox'));

web_src/js/features/repo-legacy.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,6 @@ export function initRepository() {
601601
}
602602

603603
function initRepoIssueCommentEdit() {
604-
// Issue/PR Context Menus
605-
$('.comment-header-right .context-dropdown').dropdown({action: 'hide'});
606-
607604
// Edit issue or comment content
608605
$(document).on('click', '.edit-content', onEditContent);
609606

0 commit comments

Comments
 (0)