Skip to content

fix(tags): Various issues with the multiselect tags dialog - #22287

Open
david-allison wants to merge 4 commits into
ankidroid:mainfrom
david-allison:air/15278-5b119c58-167
Open

david-allison wants to merge 4 commits into
ankidroid:mainfrom
david-allison:air/15278-5b119c58-167

Conversation

@david-allison

@david-allison david-allison commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Note

Assisted-by: GPT-6

Fixes

Approach

Fix bugs in:

  • Partially selected hierarchical tags
  • Parent tag state determination
  • RecyclerView ViewHolder messiness

How Has This Been Tested?

Unit tests added

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Using 'Edit Tags' so there are intermediate states:

With BOTH tags `B` and `B`::child` selected on a note.

* Deselect `B`
* B appears partially checked, as the child remained selected
* Submit
* `B` remains selected.

The user's intention was to remove `B`, but this didn't occur, as we used the
visible state of the tag rather than our concept of 'preserved tags'.

This fix separates out the display state, so we don't over-select tags

Assisted-by: GPT-6
If `B::child` was tagged on one note, with multiple notes:

`B` was not considered to be checked, so it would not appear at the top
 of the page.

Now it's marked as indeterminate tag, which we now include at the top
and expand.

Fixes 15278

Assisted-by: GPT-6
Indeterminate could mean two things with multiselect:
* A tag is only applied to some of the notes
* Some of a tag's children are selected, but the tag isn't

Our tag counts weren't handling this correctly, causing inconsistencies in selection
(a tag which had partially-selected descendents, or filtered tags caused this).

Now:

Counts are removed
* A checked parent tag stays checked
* A parent is indeterminate if it has selected descendants OR the tag is
  partially selected
* otherwise: unchecked

Part of 15278

Assisted-by: GPT-6
Tag nodes had stale references to ViewHolders, so an unrelated
tag's checkbox could be modified.

Node bindings are now detached correctly.

Related to 15278

Assisted-by: GPT-6
@david-allison david-allison added Blocked by dependency Currently blocked by some other dependent / related change and removed Needs Review labels Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked by dependency Currently blocked by some other dependent / related change Has Conflicts Queued for Cherry Pick to Stable Branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] In Edit tags window, hierarchical tags are not shown at the top

1 participant