Skip to content

fix: remove spurious checkbox from skills selector in custom fighters#1544

Open
tgvashworth wants to merge 1 commit intomainfrom
claude/issue-1543-20260304-0720
Open

fix: remove spurious checkbox from skills selector in custom fighters#1544
tgvashworth wants to merge 1 commit intomainfrom
claude/issue-1543-20260304-0720

Conversation

@tgvashworth
Copy link
Contributor

Fixes #1543

The group_select() helper detected multi-select widgets by checking whether the widget class name ended with "Multiple". The compact checkbox widget (BsCheckboxSelectMultipleCompact) ends with "Compact", so it was treated as a single-select and got the empty placeholder option prepended — which rendered as an errant checkbox.

Replaces the fragile class-name string check with Django’s allow_multiple_selected attribute.

Generated with Claude Code

The group_select() helper detected multi-select widgets by checking
whether the widget class name ended with "Multiple". The compact
checkbox widget (BsCheckboxSelectMultipleCompact) ends with "Compact",
so it was treated as a single-select and got the empty placeholder
option ("", "---------") prepended — which rendered as an errant
checkbox at the top of the skills list.

Replace the fragile class-name string check with Django's
allow_multiple_selected attribute, which reliably identifies
multi-select widgets regardless of their class naming.

Closes #1543

Co-authored-by: Tom Ashworth <tgvashworth@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 4, 2026 07:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue in group_select() where some multi-select widgets were incorrectly treated as single-select, causing an empty placeholder option to be prepended and rendered as a spurious checkbox in the custom fighter skills selector (Fixes #1543).

Changes:

  • Replace the widget “multiple” detection logic from a class-name suffix check (...endswith("Multiple")) to Django’s allow_multiple_selected attribute.
  • Add a regression test covering BsCheckboxSelectMultipleCompact to ensure no empty placeholder option is prepended for multi-select widgets.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
gyrinx/forms.py Uses allow_multiple_selected to reliably determine whether to prepend the empty option in group_select().
gyrinx/tests/test_forms.py Adds a regression test ensuring compact checkbox multi-select widgets do not receive an empty placeholder choice.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty dropdown option appears as checkbox in custom fighter skills selector

2 participants