Skip to content

#9121 - The Attributes panel should be disabled for a non-continuous selection of the Nucleotide (preset) type#10081

Open
mariam-khutuashvili wants to merge 2 commits into
masterfrom
9121-the-attributes-panel-should-be-disabled-for-a-non-continuous-selection-of-the-nucleotide-preset-type
Open

#9121 - The Attributes panel should be disabled for a non-continuous selection of the Nucleotide (preset) type#10081
mariam-khutuashvili wants to merge 2 commits into
masterfrom
9121-the-attributes-panel-should-be-disabled-for-a-non-continuous-selection-of-the-nucleotide-preset-type

Conversation

@mariam-khutuashvili
Copy link
Copy Markdown
Collaborator

@mariam-khutuashvili mariam-khutuashvili commented May 18, 2026

Mark as component buttons are disabled

Summary

When the user picks "Nucleotide (preset)" in the Monomer Creation Wizard and makes a non-continuous selection on
canvas, the "Mark as base/sugar/phosphate" buttons, the Code input on the preset tab, and the form fields in
MonomerCreationWizardFields are now disabled. A continuous selection keeps them enabled.

Changes

RnaPresetTabs.tsx — Compute isSelectionContinuous by passing the selected atoms plus the bonds derived from them
(bonds whose both endpoints are in the selection) to Editor.isStructureContinuous. Derive isFieldsDisabled =
hasSelectedAtoms && !isSelectionContinuous. Apply it to the "Mark as" button, the Code input, and pass it as a new
prop to MonomerCreationWizardFields.

MonomerCreationWizardFields.tsx — Add optional disabled?: boolean prop and combine it with the existing !type checks
on the four input fields (disabled={!type || disabled}).

Why derive bonds from atoms

Editor.isStructureContinuous builds its adjacency list from the selection's bonds. Canvas selections often track only
atoms (no bonds), which would make chemically connected atoms look isolated and falsely trigger the disabled state.
Deriving bonds from the struct based on the atom selection gives the correct adjacency for the connectivity check.

Scope

Only affects the Nucleotide (preset) component. Other monomer types (Amino Acid, Sugar, Base, Phosphate, CHEM as
single monomers) are unchanged. The existing submit-time "incontinuousStructure" notification still fires.

Verification

npm run test, npm run test:types, npm run build:packages, full Playwright autotests — all pass. Manual repro confirms
buttons + fields disable on non-continuous selection and re-enable on continuous selection.

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 19, 2026

Reviewed via subagents (code-quality, performance, documentation, security). Security: no concerns — pure UI flag, no new sinks. The two notable items are inline:

  • Inconsistent disabled propagation in MonomerCreationWizardFields.tsx — only Code/Name fields honor the new prop; natural analogue, modification types, and HELM/BILN aliases stay editable. This contradicts the PR description's claim that 'the form fields in MonomerCreationWizardFields are now disabled'.
  • Bond derivation in RnaPresetTabs.tsx runs unconditionally on every render and lacks an inline comment explaining the (correctness-critical) reason for deriving bonds from atoms instead of using structureSelection.bonds.

Nice reuse of the existing Editor.isStructureContinuous helper and the optional-prop-with-default keeps the change backward-compatible.

@mariam-khutuashvili mariam-khutuashvili force-pushed the 9121-the-attributes-panel-should-be-disabled-for-a-non-continuous-selection-of-the-nucleotide-preset-type branch from 03d3267 to 899e819 Compare May 20, 2026 09:54
@mariam-khutuashvili mariam-khutuashvili force-pushed the 9121-the-attributes-panel-should-be-disabled-for-a-non-continuous-selection-of-the-nucleotide-preset-type branch from 899e819 to e3dd4fc Compare May 20, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Attributes panel should be disabled for a non-continuous selection of the Nucleotide (preset) type

2 participants