Make group hit badges readable when they contain selected entries - #16700
Conversation
The badge text kept the normal badge foreground (white-ish in dark themes) on the green 'contains selected entries' background, which is unreadable. A dedicated -color-badge-selected-fg token lets each theme pick a foreground for that green. The text node carries the pseudo-classes itself because JavaFX does not restyle a descendant when a custom pseudo-class flips on its ancestor, and function values (ladder/derive) are dropped for -fx-fill on this node. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NexrEs9itF7UUEbMRRu7p3
PR Summary by QodoKeep selected group hit counts readable across themes
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1. Selected badge behavior untested
|
| for (Node styled : List.of(node, text)) { | ||
| BindingsHelper.includePseudoClassWhen(styled, PSEUDOCLASS_ANYSELECTED, | ||
| group.anySelectedEntriesMatchedProperty()); |
There was a problem hiding this comment.
1. Selected badge behavior untested 📘 Rule violation ☼ Reliability
The new pseudo-class propagation and selected badge foreground have no behavioral test; existing theme tests only validate token declaration and CSS parsing. A regression could therefore restore unreadable counts while the token contract still passes.
Agent Prompt
## Issue description
Add deterministic JavaFX coverage for the selected group badge behavior introduced by this PR.
## Issue Context
Verify that selection-property changes apply `any-selected` and `all-selected` to the badge `Text`, and that the selected foreground rule is applied. The existing token contract test checks declarations and parsing only.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/groups/GroupTreeView.java[371-375]
- jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css[1618-1620]
- jabgui/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java[34-48]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NexrEs9itF7UUEbMRRu7p3
|
"automerge", because I only resoled conflicts after the approval. |
Summary
🤖 The hit count on a group badge becomes unreadable as soon as the group contains selected entries: the badge turns green but keeps the light badge text (≈2.6:1 contrast in the dark themes). Each theme now names a foreground for that green badge, so the count stays legible in the built-in themes and in custom ones.
Analogies: like honey, the fix is small and sticks exactly where it is needed; like chocolate, it is dark on green where that reads best and white on dark green where that does; like the moon, it is only noticed when it is missing.
jabref-contrib-policy:4.2:reviewed:okSteps to test
Before / after (JabRef dark theme):
Related issues and pull requests
No issue; found while porting themes.jabref.org to #15798.
AI usage
Claude Code (model claude-fable-5), AIL4: implementation, screenshots and this description generated by the AI, reviewed and tested by me.
AI CHECKLIST.md walkthrough
1. Code self-review
Nullability and control flow
== null/!= nullchecks — JSpecify annotations used instead. (not applicable: no nullability in the change)Objects.requireNonNull(...).@NullMarked.Optionalconsumed withifPresent/ifPresentOrElse/map/orElseThrow.StringUtil.isBlank(...)used instead ofs == null || s.isBlank().Exceptions
catch (Exception e). (not applicable: no exception handling in the change)throw new RuntimeException(...)/IllegalStateException(...).Style and idioms
BibEntryobjects built with withers. (not applicable, except:List.of()used for the loop)List.of()/Map.of()/Set.of(),Path.of(), text blocks.Pattern.compile(...)constant.BackgroundTask.///) uses Markdown syntax.User-facing text
!; labels do not end with:.Security
text/htmlresponse. (not applicable)Tests
org.jabref.model/org.jabref.logichave added or updated tests. (not applicable: GUI/CSS only;ThemeTokenContractTestcovers the new token)@DisplayName, do not catch exceptions, use@TempDir.2. Verification commands
./gradlew :jablib:check(not applicable: jabgui-only change;:jabgui:compileJavaandThemeTokenContractTestpass)./gradlew checkstyleMain checkstyleTest checkstyleJmh— via CI./gradlew modernizer— via CI./gradlew --no-configuration-cache :rewriteDryRunreports no changes (rewriteRunexecuted before commit)./gradlew javadoc— via CInpx markdownlint-cli2(only if Markdown changed)3. Documentation
CHANGELOG.mdentry added.docs/requirements/<area>.md(minor fix)docs/updated (no architecture change)4. Pull request
.github/PULL_REQUEST_TEMPLATE.md, every section filled.gh pr create --body-file <file>.CHANGELOG.mdTODOplaceholder replaced with the real PR-number link after PR creation.Checklist
CHANGELOG.mddescribing the change from the user's point of view (if the change is visible to the user)🤖 Generated with Claude Code