mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-18 04:12:00 +03:00
d4f35bd681
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.
204 lines
7.3 KiB
JavaScript
204 lines
7.3 KiB
JavaScript
// bootstrap module must be the first one to be imported, it handles webpack lazy-loading and global errors
|
|
import './bootstrap.js';
|
|
|
|
import $ from 'jquery';
|
|
import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue';
|
|
import {initDashboardRepoList} from './components/DashboardRepoList.vue';
|
|
|
|
import {attachTribute} from './features/tribute.js';
|
|
import {initGlobalCopyToClipboardListener} from './features/clipboard.js';
|
|
import {initContextPopups} from './features/contextpopup.js';
|
|
import {initRepoGraphGit} from './features/repo-graph.js';
|
|
import {initHeatmap} from './features/heatmap.js';
|
|
import {initImageDiff} from './features/imagediff.js';
|
|
import {initRepoMigration} from './features/repo-migration.js';
|
|
import {initRepoProject} from './features/repo-projects.js';
|
|
import {initServiceWorker} from './features/serviceworker.js';
|
|
import {initTableSort} from './features/tablesort.js';
|
|
import {initAdminUserListSearchForm} from './features/admin/users.js';
|
|
import {initAdminConfigs} from './features/admin/config.js';
|
|
import {initMarkupAnchors} from './markup/anchors.js';
|
|
import {initNotificationCount, initNotificationsTable} from './features/notification.js';
|
|
import {initRepoIssueContentHistory} from './features/repo-issue-content.js';
|
|
import {initStopwatch} from './features/stopwatch.js';
|
|
import {initFindFileInRepo} from './features/repo-findfile.js';
|
|
import {initCommentContent, initMarkupContent} from './markup/content.js';
|
|
import {initDiffFileTree} from './features/repo-diff-filetree.js';
|
|
|
|
import {initUserAuthLinkAccountView, initUserAuthOauth2} from './features/user-auth.js';
|
|
import {
|
|
initRepoDiffConversationForm,
|
|
initRepoDiffFileViewToggle,
|
|
initRepoDiffReviewButton, initRepoDiffShowMore,
|
|
} from './features/repo-diff.js';
|
|
import {
|
|
initRepoIssueDue,
|
|
initRepoIssueList,
|
|
initRepoIssueReferenceRepositorySearch,
|
|
initRepoIssueTimeTracking,
|
|
initRepoIssueWipTitle,
|
|
initRepoPullRequestMergeInstruction,
|
|
initRepoPullRequestAllowMaintainerEdit,
|
|
initRepoPullRequestReview,
|
|
} from './features/repo-issue.js';
|
|
import {
|
|
initRepoEllipsisButton,
|
|
initRepoCommitLastCommitLoader,
|
|
initCommitStatuses,
|
|
} from './features/repo-commit.js';
|
|
import {
|
|
initFootLanguageMenu,
|
|
initGlobalButtonClickOnEnter,
|
|
initGlobalButtons,
|
|
initGlobalCommon,
|
|
initGlobalDropzone,
|
|
initGlobalEnterQuickSubmit,
|
|
initGlobalFormDirtyLeaveConfirm,
|
|
initGlobalLinkActions,
|
|
initHeadNavbarContentToggle,
|
|
initGlobalTooltips,
|
|
} from './features/common-global.js';
|
|
import {initRepoTopicBar} from './features/repo-home.js';
|
|
import {initAdminEmails} from './features/admin/emails.js';
|
|
import {initAdminCommon} from './features/admin/common.js';
|
|
import {initRepoTemplateSearch} from './features/repo-template.js';
|
|
import {initRepoCodeView} from './features/repo-code.js';
|
|
import {initSshKeyFormParser} from './features/sshkey-helper.js';
|
|
import {initUserSettings} from './features/user-settings.js';
|
|
import {initRepoArchiveLinks} from './features/repo-common.js';
|
|
import {initRepoMigrationStatusChecker} from './features/repo-migrate.js';
|
|
import {
|
|
initRepoSettingGitHook,
|
|
initRepoSettingsCollaboration,
|
|
initRepoSettingSearchTeamBox,
|
|
} from './features/repo-settings.js';
|
|
import {initViewedCheckboxListenerFor} from './features/pull-view-file.js';
|
|
import {initOrgTeamSearchRepoBox, initOrgTeamSettings} from './features/org-team.js';
|
|
import {initUserAuthWebAuthn, initUserAuthWebAuthnRegister} from './features/user-auth-webauthn.js';
|
|
import {initRepoRelease, initRepoReleaseNew} from './features/repo-release.js';
|
|
import {initRepoEditor} from './features/repo-editor.js';
|
|
import {initCompSearchUserBox} from './features/comp/SearchUserBox.js';
|
|
import {initInstall} from './features/install.js';
|
|
import {initCompWebHookEditor} from './features/comp/WebHookEditor.js';
|
|
import {initCommonIssue} from './features/common-issue.js';
|
|
import {initRepoBranchButton} from './features/repo-branch.js';
|
|
import {initCommonOrganization} from './features/common-organization.js';
|
|
import {initRepoWikiForm} from './features/repo-wiki.js';
|
|
import {initRepoCommentForm, initRepository} from './features/repo-legacy.js';
|
|
import {initFormattingReplacements} from './features/formatting.js';
|
|
import {initCopyContent} from './features/copycontent.js';
|
|
import {initCaptcha} from './features/captcha.js';
|
|
import {initRepositoryActionView} from './components/RepoActionView.vue';
|
|
import {initAriaCheckboxPatch} from './modules/aria/checkbox.js';
|
|
import {initAriaDropdownPatch} from './modules/aria/dropdown.js';
|
|
|
|
// Run time-critical code as soon as possible. This is safe to do because this
|
|
// script appears at the end of <body> and rendered HTML is accessible at that point.
|
|
initFormattingReplacements();
|
|
|
|
// Silence fomantic's error logging when tabs are used without a target content element
|
|
$.fn.tab.settings.silent = true;
|
|
// Disable the behavior of fomantic to toggle the checkbox when you press enter on a checkbox element.
|
|
$.fn.checkbox.settings.enableEnterKey = false;
|
|
// Use the patches to improve accessibility, these patches are designed to be as independent as possible, make it easy to modify or remove in the future.
|
|
initAriaCheckboxPatch();
|
|
initAriaDropdownPatch();
|
|
|
|
$(document).ready(() => {
|
|
initGlobalCommon();
|
|
|
|
initGlobalTooltips();
|
|
initGlobalButtonClickOnEnter();
|
|
initGlobalButtons();
|
|
initGlobalCopyToClipboardListener();
|
|
initGlobalDropzone();
|
|
initGlobalEnterQuickSubmit();
|
|
initGlobalFormDirtyLeaveConfirm();
|
|
initGlobalLinkActions();
|
|
|
|
attachTribute(document.querySelectorAll('#content, .emoji-input'));
|
|
|
|
initCommonIssue();
|
|
initCommonOrganization();
|
|
|
|
initCompSearchUserBox();
|
|
initCompWebHookEditor();
|
|
|
|
initInstall();
|
|
|
|
initHeadNavbarContentToggle();
|
|
initFootLanguageMenu();
|
|
|
|
initCommentContent();
|
|
initContextPopups();
|
|
initHeatmap();
|
|
initImageDiff();
|
|
initMarkupAnchors();
|
|
initMarkupContent();
|
|
initServiceWorker();
|
|
initSshKeyFormParser();
|
|
initStopwatch();
|
|
initTableSort();
|
|
initFindFileInRepo();
|
|
initCopyContent();
|
|
|
|
initAdminCommon();
|
|
initAdminEmails();
|
|
initAdminUserListSearchForm();
|
|
initAdminConfigs();
|
|
|
|
initDashboardRepoList();
|
|
|
|
initNotificationCount();
|
|
initNotificationsTable();
|
|
|
|
initOrgTeamSearchRepoBox();
|
|
initOrgTeamSettings();
|
|
|
|
initRepoActivityTopAuthorsChart();
|
|
initRepoArchiveLinks();
|
|
initRepoBranchButton();
|
|
initRepoCodeView();
|
|
initRepoCommentForm();
|
|
initRepoEllipsisButton();
|
|
initRepoCommitLastCommitLoader();
|
|
initRepoDiffConversationForm();
|
|
initRepoDiffFileViewToggle();
|
|
initRepoDiffReviewButton();
|
|
initRepoDiffShowMore();
|
|
initDiffFileTree();
|
|
initRepoEditor();
|
|
initRepoGraphGit();
|
|
initRepoIssueContentHistory();
|
|
initRepoIssueDue();
|
|
initRepoIssueList();
|
|
initRepoIssueReferenceRepositorySearch();
|
|
initRepoIssueTimeTracking();
|
|
initRepoIssueWipTitle();
|
|
initRepoMigration();
|
|
initRepoMigrationStatusChecker();
|
|
initRepoProject();
|
|
initRepoPullRequestMergeInstruction();
|
|
initRepoPullRequestAllowMaintainerEdit();
|
|
initRepoPullRequestReview();
|
|
initRepoRelease();
|
|
initRepoReleaseNew();
|
|
initRepoSettingGitHook();
|
|
initRepoSettingSearchTeamBox();
|
|
initRepoSettingsCollaboration();
|
|
initRepoTemplateSearch();
|
|
initRepoTopicBar();
|
|
initRepoWikiForm();
|
|
initRepository();
|
|
initRepositoryActionView();
|
|
|
|
initCommitStatuses();
|
|
initCaptcha();
|
|
|
|
initUserAuthLinkAccountView();
|
|
initUserAuthOauth2();
|
|
initUserAuthWebAuthn();
|
|
initUserAuthWebAuthnRegister();
|
|
initUserSettings();
|
|
initViewedCheckboxListenerFor();
|
|
});
|