Skip to content

Commit be93e15

Browse files
committed
fix
1 parent 8bab94a commit be93e15

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

web_src/js/components/DashboardRepoList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ export default defineComponent({
391391
</div>
392392
</div>
393393
</div>
394-
<overflow-menu class="ui secondary pointing tabular borderless menu repos-filter" :active="reposFilter">
394+
<overflow-menu class="ui secondary pointing tabular borderless menu repos-filter">
395395
<div class="overflow-menu-items tw-justify-center">
396396
<a class="item" tabindex="0" :class="{active: reposFilter === 'all'}" @click="changeReposFilter('all')">
397397
{{ textAll }}

web_src/js/webcomponents/overflow-menu.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {isDocumentFragmentOrElementNode, toggleClass} from '../utils/dom.ts';
44
import octiconKebabHorizontal from '../../../public/assets/img/svg/octicon-kebab-horizontal.svg';
55

66
window.customElements.define('overflow-menu', class extends HTMLElement {
7-
static observedAttributes = ['active'];
8-
97
tippyContent: HTMLDivElement;
108
tippyItems: Array<HTMLElement>;
119
button: HTMLButtonElement;
@@ -104,7 +102,16 @@ window.customElements.define('overflow-menu', class extends HTMLElement {
104102
const itemRight = item.offsetLeft + item.offsetWidth;
105103
if (menuRight - itemRight < 38) { // roughly the width of .overflow-menu-button with some extra space
106104
this.tippyItems.push(item);
105+
106+
// close tippy when clicking item of tippy
107+
item.addEventListener('click', () => {
108+
this.button?._tippy.hide();
109+
});
107110
}
111+
// refresh overflow-button active state
112+
item.addEventListener('click', () => {
113+
this.updateButtonActivationState();
114+
});
108115
}
109116
itemFlexSpace?.style.removeProperty('display');
110117
itemOverFlowMenuButton?.style.removeProperty('display');
@@ -130,14 +137,6 @@ window.customElements.define('overflow-menu', class extends HTMLElement {
130137
this.tippyContent.append(item);
131138
}
132139

133-
// close tippy when clicking item of tippy
134-
const items = this.tippyContent.querySelectorAll<HTMLElement>('.item');
135-
for (const item of items) {
136-
item.addEventListener('click', () => {
137-
this.button?._tippy.hide();
138-
});
139-
}
140-
141140
// update existing tippy
142141
if (this.button?._tippy) {
143142
this.button._tippy.setContent(this.tippyContent);
@@ -235,10 +234,6 @@ window.customElements.define('overflow-menu', class extends HTMLElement {
235234
}
236235
}
237236

238-
attributeChangedCallback() {
239-
this.updateButtonActivationState();
240-
}
241-
242237
disconnectedCallback() {
243238
this.mutationObserver?.disconnect();
244239
this.resizeObserver?.disconnect();

0 commit comments

Comments
 (0)