Skip to content

Commit 70746e7

Browse files
committed
fix more
1 parent 582f911 commit 70746e7

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

modules/templates/util_avatar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func AvatarHTML(src string, size int, class, name string) template.HTML {
3434
name = "avatar"
3535
}
3636

37-
return template.HTML(`<img loading="lazy" class="` + class + `" src="` + src + `" title="` + html.EscapeString(name) + `" width="` + sizeStr + `" height="` + sizeStr + `"/>`)
37+
return template.HTML(`<img loading="lazy" alt="" class="` + class + `" src="` + src + `" title="` + html.EscapeString(name) + `" width="` + sizeStr + `" height="` + sizeStr + `"/>`)
3838
}
3939

4040
// Avatar renders user avatars. args: user, size (int), class (string)

templates/repo/icon.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{$avatarLink := (.RelAvatarLink ctx)}}
22
{{if $avatarLink}}
3-
<img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt="{{.FullName}}">
3+
<img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt="" aria-hidden="true">
44
{{else if $.IsMirror}}
55
{{svg "octicon-mirror" 24}}
66
{{else if $.IsFork}}

web_src/js/modules/fomantic/dropdown.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,6 @@ function processMenuItems($dropdown: any, dropdownCall: any) {
7777
function delegateDropdownModule($dropdown: any) {
7878
const dropdownCall = fomanticDropdownFn.bind($dropdown);
7979

80-
// If there is a "search input" in the "menu", Fomantic will only "focus the input" but not "toggle the menu" when the "dropdown icon" is clicked.
81-
// Actually, Fomantic UI doesn't support such layout/usage. It needs to patch the "focusSearch" / "blurSearch" functions to make sure it toggles the menu.
82-
const oldFocusSearch = dropdownCall('internal', 'focusSearch');
83-
const oldBlurSearch = dropdownCall('internal', 'blurSearch');
84-
// * If the "dropdown icon" is clicked, Fomantic calls "focusSearch", so show the menu
85-
dropdownCall('internal', 'focusSearch', function (this: any) { dropdownCall('show'); oldFocusSearch.call(this) });
86-
// * If the "dropdown icon" is clicked again when the menu is visible, Fomantic calls "blurSearch", so hide the menu
87-
dropdownCall('internal', 'blurSearch', function (this: any) { oldBlurSearch.call(this); dropdownCall('hide') });
88-
8980
const oldFilterItems = dropdownCall('internal', 'filterItems');
9081
dropdownCall('internal', 'filterItems', function (this: any, ...args: any[]) {
9182
oldFilterItems.call(this, ...args);
@@ -171,7 +162,6 @@ function attachStaticElements(dropdown: HTMLElement, focusable: HTMLElement, men
171162

172163
function attachInitElements(dropdown: HTMLElement) {
173164
(dropdown as any)[ariaPatchKey] = {};
174-
if (dropdown.classList.contains('custom')) return;
175165

176166
// Dropdown has 2 different focusing behaviors
177167
// * with search input: the input is focused, and it works with aria-activedescendant pointing another sibling element.

web_src/js/modules/observer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ function callGlobalInitFunc(el: HTMLElement) {
4646
const func = globalInitFuncs[initFunc];
4747
if (!func) throw new Error(`Global init function "${initFunc}" not found`);
4848

49+
// when an element node is removed and added again, it should not be re-initialized again.
4950
type GiteaGlobalInitElement = Partial<HTMLElement> & {_giteaGlobalInited: boolean};
50-
if ((el as GiteaGlobalInitElement)._giteaGlobalInited) throw new Error(`Global init function "${initFunc}" already executed`);
51+
if ((el as GiteaGlobalInitElement)._giteaGlobalInited) return;
5152
(el as GiteaGlobalInitElement)._giteaGlobalInited = true;
53+
5254
func(el);
5355
}
5456

0 commit comments

Comments
 (0)