From d16d777d70293b1324a7ecd03766f161422734b1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 20 Mar 2023 17:00:58 +0100 Subject: [PATCH 1/4] Convert issue list checkboxes to native --- templates/repo/issue/list.tmpl | 4 +--- templates/shared/issuelist.tmpl | 6 ++---- web_src/css/helpers.css | 1 + web_src/js/features/common-issue.js | 18 +++++------------- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 38ed3873ba4c8..bb286287674ee 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -29,9 +29,7 @@
{{if $.CanWriteIssuesOrPulls}} -
- -
+ {{end}} {{template "repo/issue/openclose" .}}
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 24fa236bb48d1..b2bed9b6d7a46 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -2,11 +2,9 @@ {{$approvalCounts := .ApprovalCounts}} {{range .Issues}}
  • -
    +
    {{if $.CanWriteIssuesOrPulls}} -
    - -
    + {{end}}
    {{if .IsPull}} diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index 34d2895a5f73e..e2d195822fc0f 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -24,6 +24,7 @@ .gt-relative { position: relative !important; } .gt-overflow-x-scroll { overflow-x: scroll !important; } .gt-cursor-default { cursor: default !important; } +.gt-items-start { align-items: flex-start !important; } .gt-mono { font-family: var(--fonts-monospace) !important; diff --git a/web_src/js/features/common-issue.js b/web_src/js/features/common-issue.js index ebc851d676336..06a6a5db3b6f7 100644 --- a/web_src/js/features/common-issue.js +++ b/web_src/js/features/common-issue.js @@ -3,9 +3,8 @@ import {updateIssuesMeta} from './repo-issue.js'; import {toggleElem} from '../utils/dom.js'; export function initCommonIssue() { - const $issueSelectAllWrapper = $('.issue-checkbox-all'); - const $issueSelectAll = $('.issue-checkbox-all input'); - const $issueCheckboxes = $('.issue-checkbox input'); + const $issueSelectAll = $('.issue-checkbox-all'); + const $issueCheckboxes = $('.issue-checkbox'); const syncIssueSelectionState = () => { const $checked = $issueCheckboxes.filter(':checked'); @@ -23,7 +22,7 @@ export function initCommonIssue() { toggleElem($('#issue-filters'), !anyChecked); toggleElem($('#issue-actions'), anyChecked); // there are two panels but only one select-all checkbox, so move the checkbox to the visible panel - $('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAllWrapper); + $('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAll); }; $issueCheckboxes.on('change', syncIssueSelectionState); @@ -38,7 +37,7 @@ export function initCommonIssue() { let action = this.getAttribute('data-action'); let elementId = this.getAttribute('data-element-id'); const url = this.getAttribute('data-url'); - const issueIDs = $('.issue-checkbox').children('input:checked').map((_, el) => { + const issueIDs = $('.issue-checkbox:checked').map((_, el) => { return el.getAttribute('data-issue-id'); }).get().join(','); if (elementId === '0' && url.slice(-9) === '/assignee') { @@ -58,16 +57,9 @@ export function initCommonIssue() { // checkboxes stay checked after reload if (action === 'close' || action === 'open') { // uncheck all checkboxes - $('.issue-checkbox input[type="checkbox"]').each((_, e) => { e.checked = false }); + $('.issue-checkbox').each((_, e) => { e.checked = false }); } window.location.reload(); }); }); - - // NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay - // checked after reload trigger checked event, if checkboxes are checked on load - $('.issue-checkbox input[type="checkbox"]:checked').first().each((_, e) => { - e.checked = false; - $(e).trigger('click'); - }); } From d7ec95a539ce059c212e37b291258cd63d5652b9 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 25 Mar 2023 18:19:02 +0100 Subject: [PATCH 2/4] remove obsolete css --- web_src/css/shared/issuelist.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/web_src/css/shared/issuelist.css b/web_src/css/shared/issuelist.css index ebb1ca989b87f..26affd98a093d 100644 --- a/web_src/css/shared/issuelist.css +++ b/web_src/css/shared/issuelist.css @@ -7,10 +7,6 @@ color: var(--color-primary) !important; } -.issue.list > .item .issue-checkbox { - margin-top: 1px; -} - .issue.list > .item .issue-item-icon svg { margin-right: 0.75rem; margin-top: 1px; From b6010ab582b41afaa533f59815130a3285b9ab66 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 25 Mar 2023 18:22:50 +0100 Subject: [PATCH 3/4] prevent checkbox caching via autocomplete=off --- templates/repo/issue/list.tmpl | 2 +- templates/shared/issuelist.tmpl | 2 +- web_src/js/features/common-issue.js | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index bb286287674ee..c8d186bbfbaaf 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -29,7 +29,7 @@
    {{if $.CanWriteIssuesOrPulls}} - + {{end}} {{template "repo/issue/openclose" .}}
    diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index b2bed9b6d7a46..a8854c7d39c3c 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -4,7 +4,7 @@
  • {{if $.CanWriteIssuesOrPulls}} - + {{end}}
    {{if .IsPull}} diff --git a/web_src/js/features/common-issue.js b/web_src/js/features/common-issue.js index 06a6a5db3b6f7..25d41edde348d 100644 --- a/web_src/js/features/common-issue.js +++ b/web_src/js/features/common-issue.js @@ -53,12 +53,6 @@ export function initCommonIssue() { issueIDs, elementId ).then(() => { - // NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the - // checkboxes stay checked after reload - if (action === 'close' || action === 'open') { - // uncheck all checkboxes - $('.issue-checkbox').each((_, e) => { e.checked = false }); - } window.location.reload(); }); }); From 574708cdf141c79e2eee0f48c8081e2fcaadfc81 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 29 Mar 2023 20:45:54 +0200 Subject: [PATCH 4/4] move per-item title to aria-label --- templates/shared/issuelist.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index a8854c7d39c3c..35994fc4354b9 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -4,7 +4,7 @@
  • {{if $.CanWriteIssuesOrPulls}} - + {{end}}
    {{if .IsPull}}