Skip to content

fix(internationalized-array): collapse object values inside language rows - #2262

Open
pedrobonamin wants to merge 7 commits into
mainfrom
cursor/sieve-1956-collapsed
Open

pedrobonamin wants to merge 7 commits into
mainfrom
cursor/sieve-1956-collapsed

Conversation

@pedrobonamin

@pedrobonamin pedrobonamin commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2063. Base branch is cursor/sieve-1956-a4b6.

Summary

collapsed on an internationalized array field is copied onto the value field's options by #2063, and Studio still opens the object expanded. This PR makes collapsed start an object value collapsed inside the language row, and lines the chevron up with the language label.

The language row stays open. Only the object (a file, an image, or a custom object) collapses. Opening or closing it after that is remembered.

How it works

Studio decides collapse while it builds form state, and stores collapsed and collapsible on the field member. Copying the option onto schemaType.options later does not change that decision. Primitive values are not collapsible.

For an object value, the row sets those member flags from the merged options, using the same rules Studio uses:

  • collapsed: true also makes the object collapsible, so it can be opened again.
  • collapsible: false (or collapsable: false) keeps it open.
  • A boolean collapsed that differs from the value type's own default is treated as the editor's toggle and kept.

The collapse chevron sits in a 9px box inside Studio's legend toggle, a flex row with no cross-axis alignment, so it sits below the language label. The language row sets align-items: center on that toggle.

Try it in the test studio

https://plugins-studio-git-cursor-sieve-1956-collapsed.sanity.dev/home/structure/issue1956Repro;a25460fe-6b14-4b60-a4da-6bff8418f173

The Home workspace Issue #1956 reproduction document now starts the English file object collapsed. Open it and the file picker only offers .vtt and .srt files. Close it and the upload control hides again.

Tests

  • Collapse flags: an object starts collapsed and collapsible, an editor expand is kept, a primitive returns no flags, and collapsible: false wins over collapsed: true.
  • InternationalizedInput applies those flags on the member and still passes accept through.
  • @sanity/document-internationalization imports this plugin from source. Its Vitest config compiles the new vanilla-extract file, which otherwise fails with "Styles were unable to be assigned to a file."

Changeset

The parent PR's changeset gains the collapsed behavior. If #2063 merges first and that file is consumed, this line needs to be re-added before release.


Note

Low Risk
Editor-only form behavior in one plugin with unit tests; no auth, data, or API surface changes beyond documented field options.

Overview
collapsed on internationalized array fields now affects object values (files, images, custom objects), not only copied schemaType.options. InternationalizedInput applies collapseFlagsForValueField so each language row’s value member gets Studio-aligned collapsed / collapsible flags, preserves an editor expand/collapse toggle, and ignores primitives.

A small vanilla-extract stylesheet on the language row aligns the object collapse chevron with the language label. The plugin gains tsdown vanilla-extract output (./bundle.css), and Vitest in sanity-plugin-internationalized-array and @sanity/document-internationalization registers vanillaExtractPlugin() so workspace source imports compile .css.ts.

README, changeset, test-studio Issue #1956 repro, and agent styling docs are updated to describe supported collapsed behavior and dependent-package Vitest setup.

Reviewed by Cursor Bugbot for commit d1f1bdd. Configure here.

Follow-up to #2063. Base branch is cursor/sieve-1956-a4b6.

Summary

collapsed on an internationalized array field is copied onto the value field's options by #2063, and Studio still opens the object expanded. This PR makes collapsed start an object value collapsed inside the language row, and lines the chevron up with the language label.

The language row stays open. Only the object (a file, an image, or a custom object) collapses. Opening or closing it after that is remembered.

How it works

Studio decides collapse while it builds form state, and stores collapsed and collapsible on the field member. Copying the option onto schemaType.options later does not change that decision. Primitive values are not collapsible.

For an object value, the row sets those member flags from the merged options, using the same rules Studio uses:

  • collapsed: true also makes the object collapsible, so it can be opened again.
  • collapsible: false (or collapsable: false) keeps it open.
  • A boolean collapsed that differs from the value type's own default is treated as the editor's toggle and kept.

Chevron alignment

The language label is a <Label> the plugin passes as the field title, and Studio wraps it in its own title <Text>. Both components trim their line height to the cap height, so the 7px label sits about 6px above the chevron. When the row is collapsible, the label gets an inline display: inline-block; vertical-align: middle, which centers it on the line the chevron sits on. Rows without a chevron keep the label as it was.

No stylesheet, build or Vitest changes are needed.

Try it in the test studio

https://plugins-studio-git-cursor-sieve-1956-collapsed.sanity.dev/home/structure/issue1956Repro;a25460fe-6b14-4b60-a4da-6bff8418f173

The Home workspace Issue #1956 reproduction document now starts the English file object collapsed. Open it and the file picker only offers .vtt and .srt files. Close it and the upload control hides again.

Collapsed row: chevron aligned with the EN label
Expanded row: chevron aligned with the EN label

Tests

  • Collapse flags: an object starts collapsed and collapsible, an editor expand is kept, a primitive returns no flags, and collapsible: false wins over collapsed: true.
  • InternationalizedInput applies those flags on the member and still passes accept through.

Changeset

The parent PR's changeset gains the collapsed behavior. If #2063 merges first and that file is consumed, this line needs to be re-added before release.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

@pedrobonamin
pedrobonamin added this pull request to stack #2263 October 26, 2026 13:54
@changeset-bot

changeset-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3a2d630

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
sanity-plugin-internationalized-array Patch
@sanity/document-internationalization Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
plugins-studio Ready Ready Preview Nov 2, 2026 7:40am UTC
1 Skipped Deployment
Project Deployment Actions Updated
plugins-e2e-test-studio Ignored Ignored Nov 2, 2026 7:40am UTC

Request Review

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

✅ E2E Tests

🟢 46 passed • view full report • view run

Studio: https://plugins-e2e-test-studio-58mv8pyk2.sanity.dev

Datasets: pr-2262-chromium-41407619887, pr-2262-firefox-41407619887

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 39.02% 7933 / 20328
🔵 Statements 38.97% 8531 / 21887
🔵 Functions 34.56% 2166 / 6267
🔵 Branches 31.28% 4639 / 14828
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
plugins/sanity-plugin-internationalized-array/src/components/InternationalizedInput.tsx 60.29% 41.42% 82.35% 58.46% 37, 133-199, 223
plugins/sanity-plugin-internationalized-array/src/utils/optionsForValueField.ts 100% 97.43% 100% 100%
Generated in workflow #11489 for commit 3a2d630 by the Vitest Coverage Report Action

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d1f1bdd. Configure here.

@pedrobonamin
pedrobonamin marked this pull request as ready for review October 26, 2026 14:24
@pedrobonamin
pedrobonamin requested a review from a team as a code owner October 26, 2026 14:24
@pedrobonamin
pedrobonamin requested review from juice49 and removed request for a team October 26, 2026 14:24
Base automatically changed from cursor/sieve-1956-a4b6 to main October 27, 2026 13:04
@pedrobonamin
pedrobonamin force-pushed the cursor/sieve-1956-collapsed branch from 3d8d98d to 1d45bbf Compare October 27, 2026 13:04
cursoragent and others added 7 commits November 2, 2026 07:35
Studio computed collapsed from the shared value type, so the option on an
internationalized array field never reached an object such as a file. Apply
it on the value field member and keep a later editor toggle.

Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
Knip flagged collapseStateFromOptions; it is only used in the same
module, so keep it private.

Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…uage

Center the legend toggle on the language label so the chevron lines up with it.

Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…ests

Workspace imports of internationalized-array load its .css.ts source. Register
the vanilla-extract Vitest plugin so those tests can transform it.

Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…ne style

Replace the vanilla-extract stylesheet with an inline style on the
language label, applied only when the row is collapsible. Drop the
bundle.css export and the vanilla-extract build and Vitest setup this
needed in both plugins.

Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
The accept passthrough already shipped with #2063, and Version Packages
consumed that changeset. This file now describes only the collapsed
object behavior.

Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview – plugins-studio — 3a2d6307 Deployed Nov 2, 2026 by vercel[bot]
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.

2 participants