Skip to content

Commit e01b001

Browse files
Improve a11y document and dropdown item (#29753)
Co-authored-by: silverwind <[email protected]>
1 parent 3e94ac5 commit e01b001

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/content/contributing/guidelines-frontend.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
5353
### 可访问性 / ARIA
5454

5555
在历史上,Gitea大量使用了可访问性不友好的框架 Fomantic UI。
56-
Gitea使用一些补丁使Fomantic UI更具可访问性(参见`aria.js``aria.md`),
56+
Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`),
5757
但仍然存在许多问题需要大量的工作和时间来修复。
5858

5959
### 框架使用

web_src/js/modules/fomantic/aria.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
This document is used as aria/accessibility(a11y) reference for future developers.
44

5-
There are a lot of a11y problems in the Fomantic UI library. This `aria.js` is used
6-
as a workaround to make the UI more accessible.
5+
There are a lot of a11y problems in the Fomantic UI library. Files in
6+
`web_src/js/modules/fomantic/` are used as a workaround to make the UI more accessible.
77

8-
The `aria.js` is designed to avoid touching the official Fomantic UI library,
8+
The aria-related code is designed to avoid touching the official Fomantic UI library,
99
and to be as independent as possible, so it can be easily modified/removed in the future.
1010

1111
To test the aria/accessibility with screen readers, developers can use the following steps:
@@ -14,7 +14,7 @@ To test the aria/accessibility with screen readers, developers can use the follo
1414
* Press `Command + F5` to turn on VoiceOver.
1515
* Try to operate the UI with keyboard-only.
1616
* Use Tab/Shift+Tab to switch focus between elements.
17-
* Arrow keys to navigate between menu/combobox items (only aria-active, not really focused).
17+
* Arrow keys (Option+Up/Down) to navigate between menu/combobox items (only aria-active, not really focused).
1818
* Press Enter to trigger the aria-active element.
1919
* On Android, you can use TalkBack.
2020
* Go to Settings -> Accessibility -> TalkBack, turn it on.
@@ -75,7 +75,7 @@ Fomantic Dropdown is designed to be used for many purposes:
7575
Fomantic Dropdown requires that the focus must be on its primary element.
7676
If the focus changes, it hides or panics.
7777

78-
At the moment, `aria.js` only tries to partially resolve the a11y problems for dropdowns with items.
78+
At the moment, the aria-related code only tries to partially resolve the a11y problems for dropdowns with items.
7979

8080
There are different solutions:
8181

web_src/js/modules/fomantic/dropdown.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function updateMenuItem(dropdown, item) {
3838
if (!item.id) item.id = generateAriaId();
3939
item.setAttribute('role', dropdown[ariaPatchKey].listItemRole);
4040
item.setAttribute('tabindex', '-1');
41-
for (const a of item.querySelectorAll('a')) a.setAttribute('tabindex', '-1');
41+
for (const el of item.querySelectorAll('a, input, button')) el.setAttribute('tabindex', '-1');
4242
}
4343

4444
// make the label item and its "delete icon" has correct aria attributes

0 commit comments

Comments
 (0)