Skip to content

fix(models): rank related models by the active main model in pickers - #10246

Open
Pfannkuchensack wants to merge 4 commits into
invoke-ai:mainfrom
Pfannkuchensack:fix/related-models-picker-anchor
Open

Pfannkuchensack wants to merge 4 commits into
invoke-ai:mainfrom
Pfannkuchensack:fix/related-models-picker-anchor

Conversation

@Pfannkuchensack

@Pfannkuchensack Pfannkuchensack commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Models linked in the Model Manager ("Related models") had no visible effect while generating. The picker loaded links for its own selected value. Main-to-main links are not allowed, LoRA pickers have no value, and single-slot types (VAE, encoders) cannot link to themselves, so the link hint practically never appeared.

ModelSelect now takes a relatedTo anchor:

  • Generate (VAE, components, LoRA concepts, reference images), Video (components, LoRA concepts) and Upscale (LoRA, tile ControlNet, VAE, components) pickers anchor on the active main model.
  • Model default settings pickers anchor on the model being edited.
  • Linked models rank first within their base group. Their link icon's tooltip and accessible label name the anchor: "Linked to ". If the anchor is not in the catalog, the label falls back to "Linked model".
  • Main, refiner, text LLM, upscaler (spandrel) pickers and workflow fields have no anchor. A workflow has no single main model.

Before: select an SDXL main model linked to two LoRAs, open "Add concept". The LoRAs are listed alphabetically with no marker.
After: the two linked LoRAs come first, each with a link icon and the tooltip "Linked to

".

QA Instructions

  • pnpm lint: passes.
  • pnpm test:browser src/features/models/ui/components/ModelSelect.browser.test.tsx: 18/18. New tests cover three cases: a linked model ranks first and is labelled with the anchor's name, links of the picker's own value no longer mark anything, and the fallback label when the anchor is missing.
  • Browser, pnpm dev:mock, with the relationships endpoint returning links for one SDXL main model:
    • With the linked main model selected, the "Add concept" picker lists both linked LoRAs first, with icon and tooltip.
    • After switching to an unlinked SDXL main model, there is no icon and the order is alphabetical.
    • No console errors besides the mock's missing socket.
  • Not checked in the browser: the default-settings picker. The mock fixtures have no VAE that matches a main model's base. That path is covered by type checks and the shared ModelSelect tests.

Review

No material findings. A minor lookup cost was addressed: the anchor name is now read from the existing modelsByKey map. A test for the fallback label was added.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Meaningful regression coverage added / updated where needed; obsolete tests/code removed
  • Persisted-state and API changes include required migrations / compatibility validation
  • Relevant performance/efficiency opportunities considered; material claims have evidence
  • Material review findings resolved and relevant checks rerun
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

ModelSelect takes a `relatedTo` anchor instead of using its own value, which never had linkable candidates.
Generate, Video and Upscale component, LoRA, VAE and reference pickers anchor on the active main model; model default settings anchor on the edited model.
Linked models rank first in their base group with an icon naming the anchor model.
@github-actions github-actions Bot added the frontend PRs that change frontend files label Nov 12, 2026

@joshistoast joshistoast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JK found an accessibility issue

Comment on lines +579 to +580
<Tooltip content={linkedLabel}>
<Icon as={LinkIcon} aria-label={linkedLabel} boxSize="3" color="accent.solid" flexShrink={0} />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Make the linked-model hint readable by screen readers.

Chakra’s Icon defaults to aria-hidden="true", so the new “Linked to [model]” label is hidden despite having an aria-label. Chromium’s accessibility tree confirms that an option reads only “Beta VAE,” without its relationship information. Keyboard focus also stays in the search field, so the icon’s tooltip provides no keyboard alternative.

The hiding behavior predates this PR, but now affects the newly enabled relationship hints in concept pickers. Expose the relationship through the option’s accessible text or description, and test that output rather than just checking the label attribute.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bc13638. The link icon is now explicitly aria-hidden and keeps its tooltip for pointer users. The label goes into the option text as VisuallyHidden, so the option reads e.g. "Fixture Model 027, Linked to Fixture Model 006 …" (checked in the Chromium accessibility tree on the mock). The tests now assert the option's accessible name via toHaveAccessibleName, including that unlinked options carry no link text.

Chakra hides icons from assistive technology, so the link icon's label
never reached screen readers, and the tooltip is unreachable while focus
stays in the search field. Put the label into the option's text as
visually hidden content and assert the option's accessible name.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants