In search-mode, select only search-matched descendants

Context: "Filter lists" pane.
This commit is contained in:
Raymond Hill 2023-05-17 09:21:14 -04:00
parent 0fa4cae4b2
commit d6eacd8cf6
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 5 additions and 2 deletions

View File

@ -378,8 +378,11 @@ const toggleFilterList = (elem, on, ui = false) => {
input.checked = on; input.checked = on;
dom.cl.toggle(listEntry, 'checked', on); dom.cl.toggle(listEntry, 'checked', on);
dom.cl.toggle(listEntry, 'stickied', ui && !on); dom.cl.toggle(listEntry, 'stickied', ui && !on);
// Select/unselect descendants // Select/unselect descendants. Twist: if in search-mode, select only
const childListEntries = qsa$(listEntry, '.listEntry'); // search-matched descendants.
const childListEntries = dom.cl.has('#lists', 'searchMode')
? qsa$(listEntry, '.listEntry.searchMatch')
: qsa$(listEntry, '.listEntry');
for ( const descendantList of childListEntries ) { for ( const descendantList of childListEntries ) {
dom.cl.toggle(descendantList, 'checked', on); dom.cl.toggle(descendantList, 'checked', on);
qs$(descendantList, ':scope > .detailbar input').checked = on; qs$(descendantList, ':scope > .detailbar input').checked = on;