You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/templates
wxiaoguang d4f35bd681
Use a general approch to improve a11y for all checkboxes and dropdowns. (#23542)
This PR follows #22599 and #23450

The major improvements:

1. The `aria-*.js` are totally transparent now, no need to call
`attachDropdownAria` explicitly anymore.
* It hooks the `$.fn.checkbox` and `$.fn.dropdown`, then our patch
works.
* It makes all dynamically generated checkbox/dropdown work with a11y
without any change
* eg: the `conversation.find('.dropdown').dropdown();` in `repo-diff.js`
2. Since it's totally transparent now, it could be easier to modify or
remove in the future.
3. It handles all selection labels as well (by onLabelCreate), so it
supports "multiple selection dropdown" now.
* It partially completes one of my TODOs: `TODO: multiple selection is
not supported yet.`
4. The code structure is clearer, code blocks are splitted into
different functions.
* The old `attachOneDropdownAria` was splitted into separate functions.
* It makes it easier to add more fine tunes in the future, and co-work
with contributors.
6. The code logic is similar as before, only two new parts: 
    1. the `ariaCheckboxFn` and `ariaDropdownFn` functions
    2. the `onLabelCreate` and `updateSelectionLabel` functions

In `aria-dropdown.js` I had to mix jQuery and Vanilla JS somewhat, I
think the code is still understandable, otherwise the code would be much
more complex to read.

Thanks to fsologureng for the idea about "improving the 'delete icon'
with aria attributes".

If there is anything unclear or incorrect, feel free to ask and discuss,
or propose new PRs for it.
1 year ago
..
admin Fix `.locale.Tr` function not found in delete modal (#23468) 1 year ago
api/packages/pypi Add Package Registry (#16510) 2 years ago
base Use a general approch to improve a11y for all checkboxes and dropdowns. (#23542) 1 year ago
code Fix 'View File' button in code search (#23478) 1 year ago
custom Add footer extra links template (#9576) 5 years ago
explore Fix long name ui issues and label ui issue (#23541) 1 year ago
mail Revert relative links to absolute links in mail templates (#23267) 1 year ago
org Replace a few fontawesome icons with svg (#23602) 1 year ago
package Convert `<div class="button">` to `<button class="button">` (#23337) 1 year ago
projects Use `project.IconName` instead of repeated unreadable `if-else` chains (#23538) 1 year ago
repo Decouple the issue-template code from comment_tab.tmpl (#23556) 1 year ago
shared Display the version of runner in the runner list (#23490) 1 year ago
status Move helpers to be prefixed with `gt-` (#22879) 1 year ago
swagger Add absent repounits to create/edit repo API (#23500) 1 year ago
user Remove conflicting CSS rules on notifications, improve notifications table (#23565) 1 year ago
home.tmpl Add main landmark to templates and adjust titles (#22670) 1 year ago
install.tmpl Refactor hiding-methods, remove jQuery show/hide, remove `.hide` class, remove inline style=display:none (#22950) 1 year ago
post-install.tmpl Fix various bugs for "install" page (#23194) 1 year ago