-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove customized (unmaintained) dropdown, improve aria a11y for dropdown #19861
Remove customized (unmaintained) dropdown, improve aria a11y for dropdown #19861
Conversation
8205593
to
95fed85
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
95fed85
to
0da4f05
Compare
I did some testing of this using Orca with Chromium. Some notes:
|
Thanks for creating this PR. Dropdowns were Tested via VoiceOver under MacOS and iOS, and NVDA and Jaws under Windows, the functionality is almost identical to the old patch, which is definitely great to see. The tabIndex and the .click() method are likely the two things that need a fix. Regarding the role, I can't think of a case when a listbox would be better, as the usage from a screen reader user's standpoint is almost identical. It might be, however, that for filtering reasons, specific pages will need a specific role, but I think this can be addressed in later PRs, when needed. |
I need some more details about some points:
Which icon? Can you help to provide the page/DOM/element for it? I have difficulty to reproduce the focus-twice problem ....
Fixed on the repo perssmion page. Indeed it's a misuse of dropdown.
The difference between combobox and menu:
So, in my mind that's the proper roles, because the dropdown behaves like a combobox (but in some cases it is used as a menu). |
On Wed, Jun 01, 2022 at 04:39:10AM -0700, wxiaoguang wrote:
Which icon? Can you help to provide the page/DOM/element for it? I have difficulty to reproduce the focus-twice problem ....
Sorry, my mistake: What's happening is that once the menu opens, the next tab is to the first menu item instead of the next menu. Once you tab the menu closes and you're lost.
> The click() and repo collaborator permissions
I think the problem might be fixed on the collaborator permissions page, instead of changing the dropdown's behavior. I will look into it later.
The problem I think is that the code uses a jQuery click() method which
does not work with keyboard events. Only .click() works with keyboard
events.
> role=combobox/option
The difference between combobox and menu:
* combobox has a text field and a option list. If the option is changed, the text field is also updated.
* menu has a button and a menu list, the menu item only triggers actions, doesn't change the menu button.
So, in my mind that's the proper roles in my mind, because the dropdown behaves like a combobox (but in some cases it is used as a menu).
I guess. I see you also have to code to set it to listbox but that doesn't tend to work? For instance, the language list at the bottom of the page is marked combobo, so are the two menus at the top right.
|
I looked at the collaboration fix you did. I initially thought it didn't work because I couldn't rebuild it, but I find the new solution unacceptable: You don't have to press enter to confirm your selection. If you go through the box list and leave the box it changes it anyway. |
Then let's use
It's still a little diffcult for me to reproduce. Could you provide detailed steps (using a real page UI)? For example, open page A, focus element X, press Tab, (see what) press Tab, (see what), etc. |
The clicking now works, but the button doesn't change to show the result now? So if I change it to 'read' then it will update only if I refresh. It remembers what I pressed in the menu though. Guide for reproducing: Open http://localhost:3000/adminadmin/test/settings/collaboration, focus address bar, starting tabbing until you open the create menu. Now tab again. The second menu doesn't come up. You're instead focused on the first menu's first item. |
I think it behaves well in most cases now.
Oh, that's helpful, improved and added more comments. |
… item non-focusable
3d64264
to
1aa14a0
Compare
That's what I mentioned |
This all seems to work good. There are some issues where I've managed to focus and open the menus without Orca entering focus mode- but this might just be some Linux a11y bug. It seems to coincide with system lag. It might be something to do with me accidentally enabling caret browisng, not sure. Edit: To be clear: I'm 100% for this being merged but I would like @Flameborn to check out this focus issue on MacOS. |
…t) for aria-label, prevent from repeated attaching
After some testing, it seems that menu/menuitem behaves better than combobox/option. So I just made another commit, please have a try. |
Looks and sounds good to me. I did just find that setting the language doesn't work, but this might be a click() thing again. |
Hmmm, I think I know the update: Fixed, now all And added more comments:
|
5dcbfb3
to
16f85a5
Compare
This PR is ready for review. |
I did a quick test and it seems to work fine.
|
* giteaofficial/main: Add API to serve blob or LFS file content (go-gitea#19689) Disable unnecessary mirroring elements (go-gitea#18527) [skip ci] Updated translations via Crowdin Remove customized (unmaintained) dropdown, improve aria a11y for dropdown (go-gitea#19861) Set Setpgid on child git processes (go-gitea#19865)
@wxiaoguang |
I have run I tried Maybe the EOL could be improved in another PR when upgrading Fomantic UI. |
It's not EOL-only for me. This is my result after Not sure why you can't reproduce. |
But the Can you reproduce it on a clear clone? Or can you do a grep to find where is the string |
Hmm yes, it doesn not reproduce on fresh checkout, must be related to untracked files. EOL diff should still be fixed though. Search result does show some matches:
|
Maybe you have copied the modified file to there manually, then your every build will use it. Changing files under |
Might be because previous patches were actually done inside Regarding CRLF, we need to normalize. Normally, I'd use tools like |
#19932 will fix it. |
…down (go-gitea#19861) * Remove customized (unmaintained) dropdown, improve aria a11y for dropdown * fix repo permission * use action instead of onChange * re-order the CSS selector * fix dropdown behavior for repo permissions, make elements inside menu item non-focusable * use menu/menuitem instead of combobox/option. use tooltip(data-content) for aria-label, prevent from repeated attaching * click menu item when pressing Enter * code format * fix repo permission * repo setting: prevent from misleading users when error occurs * fine tune the repo collaboration access mode dropdown (in case the access mode is undefined in the template) Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
…m, tippy problem (#23450) This PR is extracted from #23346 to address some unclear (I don't understand) code-belonging concerns. This PR needs to be backported, otherwise the `aria.js` is too buggy in some cases. Since there would be two minor conflicts, I will do the backport manually. Before: the `aria.js` is still buggy in some cases. After: tested with AppleVoice, Android TalkBack * Fix incorrect dropdown init code * Fix incorrect role element (the menu role should be on the `$menu` element, but not on the `$focusable`) * Fix the focus-show-click-hide problem on mobile. Now the language menu works as expected * Fix incorrect dropdown template function setting * Clarify the logic in aria.js * Hide item's tippy after menu gets hidden * Fix incorrect tippy `setProps` after `destroy` * Fix UI lag problem when page gets redirected during menu hiding animation with screen reader * Improve comments * Implement the layout proposed by #19861 <details> https://github.com/go-gitea/gitea/blob/d74a7efb60f94a4b8e6e5f65332f94f1be31b761/web_src/js/features/aria.md?plain=1#L38-L47 </details>
…blem, tippy problem (#23450) (#23486) Before: the `aria.js` is still buggy in some cases. After: tested with AppleVoice, Android TalkBack (I tested it with 1.19 again) * Fix incorrect dropdown init code * Fix incorrect role element (the menu role should be on the `$menu` element, but not on the `$focusable`) * Fix the focus-show-click-hide problem on mobile. Now the language menu works as expected * Fix incorrect dropdown template function setting * Clarify the logic in aria.js * Fix incorrect tippy `setProps` after `destroy` * Improve comments * Implement the layout proposed by #19861
Background
According to #8638 (comment) , the customized dropdown is unmaintained.
To make the code maintainable again, this PR removes that customized dropdown, and use a general method to make a11y work with Fomantic UI dropdown.
There are some problems on Fomantic UI side, so the a11y support is not perfect (see the comment), I think it's still better than before (compared to https://try.gitea.io/repo/create), and there will be no blocker to follow the latest Fomantic UI releases.
Close #10672, Close #16581
Some explanations
initRepoSettingsCollaboration
becomes more complex: because it has to behave correctly with aria/a11y. Before this PR, the behavior was not correct, this PR considers more (maybe all) edge cases._form.less
: before this PR it made the inputs inside the dropdown half-width, which was incorrect. This PR fixes it.TODOs
Since I am not expert for aria, if there is anything incorrect or to be improved, please edit on this PR directly or propose PRs for it. Feel free to make it more correct.
Screenshots
The best page to test is
http://localhost:3000/repo/create
(compared to https://try.gitea.io/repo/create)