Skip to content

feat(field-toolbar): show the Edit button for Taxonomy fields on the canvas toolbar - #669

Merged
SahilCs15 merged 4 commits into
develop_v4from
agent/taxonomy-field-edit-button
Oct 28, 2026
Merged

SahilCs15 merged 4 commits into
develop_v4from
agent/taxonomy-field-edit-button

Conversation

@SahilCs15

@SahilCs15 SahilCs15 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Taxonomy fields now get the Edit button on the canvas toolbar, the same way a multiple Select does.

  • ALLOWED_MODAL_EDITABLE_FIELD includes FieldDataType.TAXONOMY, and fieldIcons maps taxonomy to EditIcon.
  • In FieldToolbar.tsx, a new isTaxonomyField flag sits next to isMultipleSelect. When either is true, the field gets the modal Edit button, move left, move right and delete are hidden, and the Edit payload points at the whole field (instance.fieldPathWithIndex set to fieldPathWithIndex, multipleFieldMetadata.index set to -1).
  • The add buttons around a Taxonomy field are unchanged and still send add-instance.
  • The open-field-edit-modal payload keeps its shape.

Behaviour change on the canvas: clicking one Taxonomy term no longer shows move or delete buttons.

Test evidence

  • npm run lint: 0 errors (warnings are existing ones).
  • npx prettier --check on the changed files that were clean on the base: passes. FieldToolbar.tsx and fieldToolbar.test.tsx were already not Prettier-clean on develop_v4, so they were left unformatted to keep the diff small.
  • npx vitest run --changed origin/develop_v4: 76 files, 518 tests passed.
  • npm run build: passes.

Criteria and tests

Criterion Test
Clicking one term or the whole list shows Edit, Form and comment, with no move or delete fieldToolbar.test.tsx, "Taxonomy field toolbar": term click and whole-list click tests
Edit sends the whole-field path with index -1, as for a multiple Select fieldToolbar.test.tsx: term click sends the whole-field payload; a term inside a modular block keeps the parent index
Edit is disabled when isFieldDisabled says so fieldToolbar.test.tsx: disabled Edit test
Add buttons still show for Taxonomy handleIndividualFields.test.ts: "still adds instance buttons for a multiple Taxonomy field"
Multiple Select keeps its behaviour existing multiple Select tests in fieldToolbar.test.tsx and handleIndividualFields.test.ts

Manual QA

None needed for this change on its own. The modal that opens for Taxonomy lives in Visual Editor, which ships separately.

Release note

This should not go to stage_v4 or main until the matching Visual Editor change for the Taxonomy modal is in production in every region. Without it, an older Visual Editor closes the modal for this field type.

The same holds for the dev environment: once this merges to develop_v4, dev shows the Edit button for Taxonomy, and the modal closes right away until the Visual Editor Taxonomy modal is deployed there. Merging waits for a reviewer's approval, so a reviewer can hold the approval until that Visual Editor change is on dev.

Follow-up

After a term click, the comment, variant revert and Form actions still get the term-level metadata. Multiple Select does the same today, so this is left for a follow-up that covers both field types.


🤖 Generated with Claude Code

Posted by ve-developer (Claude)


Generated by Claude Code


Generated by Claude Code

@snyk-io

snyk-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 2 0 10 ✅ Passed
🟠 High Severity 2 0 25 ✅ Passed
🟡 Medium Severity 1 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 68.7% 2595 / 3777
🔵 Statements 67.58% 2638 / 3903
🔵 Functions 66.28% 468 / 706
🔵 Branches 63.02% 1570 / 2491
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/visualBuilder/components/FieldToolbar.tsx 70.31% 71.28% 57.14% 70.31% 67-94, 105-112, 180-181, 229-245, 309-316, 347-353, 363, 367, 420-424, 443
src/visualBuilder/components/icons/fields/index.ts 100% 100% 100% 100%
src/visualBuilder/utils/constants.ts 100% 100% 100% 100%
src/visualBuilder/utils/handleIndividualFields.ts 100% 85% 100% 100%
Generated in workflow #949 for commit 2d2036c by the Vitest Coverage Report Action

@altsh-cs
altsh-cs self-requested a review October 28, 2026 07:26
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 2 0 10 ✅ Passed
🟠 High Severity 2 0 25 ✅ Passed
🟡 Medium Severity 1 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@SahilCs15

Copy link
Copy Markdown
Contributor Author

Automated self-review (commit 9b34a1d)

Mostly clean. There's one behavior inconsistency to settle before merge, plus some redundant code and tests.

src/visualBuilder/utils/handleIndividualFields.ts (and its new test)

  • Taxonomy still gets per-term add buttons while the toolbar treats it as one value. Line 74 adds instance buttons for every multiple field except Select, and the new test still adds instance buttons for a multiple Taxonomy field locks that in. In the toolbar, though, taxonomy hides move and delete and rebinds edit to the whole field. A user can still click "+" next to a term, which inserts at an index. If the editor side can't do an indexed insert into a taxonomy value, that's a broken path. Either exclude TAXONOMY at line 74 like SELECT and flip the test, or add a line to the PR explaining why indexed add is valid for taxonomy but move and delete are not.

src/visualBuilder/components/FieldToolbar.tsx

  • isTaxonomyField ignores isMultiple, while isMultipleSelect checks it. That works because taxonomy is always multiple. A short comment saying so would stop someone from adding && isMultiple later just to make the two match.

src/visualBuilder/utils/constants.ts

  • Adding TAXONOMY to ALLOWED_MODAL_EDITABLE_FIELD does nothing. The only consumer is FieldToolbar.tsx:207, and it's in the else branch, which taxonomy never reaches now that isTaxonomyField short-circuits first. Pick one mechanism. Keeping both means a later change to one of them silently disagrees with the other.

src/visualBuilder/components/__test__/fieldToolbar.test.tsx

  • renders the Edit button for a Taxonomy field duplicates term click shows edit without move or delete. It renders the same metadata and asserts on the same test id. It also repeats the setup that renderTaxonomy already wraps. Drop it.
  • taxonomySchema and termMetadata sit at the top of the describe block, while TAX_EDIT_ID, TAX_PREFIX and the helpers are declared between tests. Move them all up together so the block reads top-down.
  • Nothing covers the "is instance actually rewritten" case outside handleEdit. The new tests only drive the edit button. If any other toolbar path forwards fieldMetadata for taxonomy (comments or the field path dropdown, for example), check whether it also needs the index-stripped metadata.

Generated locally by Claude on push. A first pass, not a substitute for human review.

@altsh-cs altsh-cs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small change, and reusing the multiple Select path makes sense. The Edit payload doesn't mutate the caller's metadata, and the disabled-state mock is reset by the outer beforeEach, so no leak between tests. No blockers from me, just a couple of things worth confirming and two small test cleanups inline.

One note on release order: the description says this shouldn't reach stage_v4 or main until the Visual Editor Taxonomy modal is live in every region. The same applies to develop_v4. Once this merges, the dev environment shows the Edit button, and if the matching Visual Editor change isn't deployed there yet the modal closes right away. Could we merge this after that change is deployed to dev, or link it in the description so the dependency is easy to track?

…olbar tests

Note why Select skips canvas add buttons while Taxonomy keeps them, and
that Taxonomy is always multiple. Drop a duplicate Edit button test, keep
the Taxonomy test setup at the top of its block, and cover a Taxonomy
inside a modular block keeping its parent index on Edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhGzeCtGiaD8r2BWLkqEWx
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 2 0 10 ✅ Passed
🟠 High Severity 2 0 25 ✅ Passed
🟡 Medium Severity 1 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

Copy link
Copy Markdown
Contributor Author

Re: #669 (review)

Good point about dev. The PR body now says it: once this merges to develop_v4, dev shows the Edit button for Taxonomy, and the modal closes right away until the Visual Editor Taxonomy modal is deployed there. The merge waits for an approval, so @altsh-cs, you can hold yours until that change is on dev. The inline threads are answered, and the test changes are in 2d2036c.

Posted by ve-developer (Claude)


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Re: #669 (comment)

  • Taxonomy add buttons: these stay on purpose, because the Visual Editor opens its term picker from the add control. A comment at that condition says why (2d2036c).
  • isTaxonomyField without isMultiple: added a one-line comment that Taxonomy is always multiple (2d2036c).
  • TAXONOMY in ALLOWED_MODAL_EDITABLE_FIELD: kept. The ticket asks for it, and it keeps the list of modal-editable types complete for any code that reads it. Taxonomy reaching the isTaxonomyField branch first doesn't change the result.
  • Duplicate Edit button test: removed, and the Taxonomy constants and helpers moved to the top of the block (2d2036c).
  • Other toolbar paths with term-level metadata: comments, revert and Form still get the term metadata, as they do for a multiple Select. Left for a follow-up covering both (see the reply on the review thread).

Posted by ve-developer (Claude)


Generated by Claude Code

@altsh-cs altsh-cs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!!!

@altsh-cs
altsh-cs self-requested a review October 28, 2026 07:54

@karancs06 karancs06 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!!

@SahilCs15
SahilCs15 merged commit ab49ee5 into develop_v4 Oct 28, 2026
10 checks passed
@SahilCs15
SahilCs15 deleted the agent/taxonomy-field-edit-button branch October 28, 2026 07:55
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.

4 participants