Skip to content

fix: render select labels before dropdown opens - #212

Open
reatang wants to merge 1 commit into
mainfrom
reatang/jolly-lovelace-2ebbbe
Open

fix: render select labels before dropdown opens#212
reatang wants to merge 1 commit into
mainfrom
reatang/jolly-lovelace-2ebbbe

Conversation

@reatang

@reatang reatang commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #211. base-ui's Select.Value falls back to the raw option value when given no children or items mapping, so every SelectValue without children whose option labels differ from their values showed the raw value (e.g. async, Ki, vault-transit) until the dropdown was first opened.

This PR audits all SelectValue usages without children and passes the current label as children (falling back to the placeholder via null when nothing is selected), following the existing pattern in performance-server-list.tsx (sortLabels):

  • SSE page — KMS backend select (backendTypeLabels map; the original fix: render KMS backend label in closed select #211 scenario, applied here since that fix was not on this branch's base)
  • Bucket info — bucket policy, encryption type, and KMS key selects (KMS key labels come from key tags/description, looked up in kmsKeyOptions)
  • Lifecycle new form — both Object Version selects (reuse versionOptions)
  • Site replication new/edit forms — TLS verification mode selects and the edit form's Sync state select
  • Bucket replication new/edit forms — Mode, TLS verification, and bandwidth unit selects (reuse modeOptions/unitOptions)

Audited and intentionally unchanged because label === value: event ARN select, replication Storage Class selects, lifecycle Storage Type (tier names), and pagination page-size select.

Type notes: BucketPolicyType includes values the policy select does not offer (none, readonly, …) and SiteReplicationSyncState includes unknown, so those two label maps use Partial<Record<…>> with a fallback to the raw value / placeholder.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • Unit tests added/updated
  • Manual testing completed
pnpm test:run

Ran via corepack pnpm@11.11.0: type-check ✅, lint ✅, format:check ✅ (only the pre-existing components/object/tiff-viewer.tsx failure on main remains), test:run ✅ (401 tests pass).

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

Follow-up to #211.

Additional Notes

The fix pattern relies on base-ui behavior: plain SelectValue children override the raw-value fallback, and null children fall through to the placeholder.

base-ui's Select.Value falls back to the raw option value when no items
mapping or children are provided, so selects whose option labels differ
from their values (translated or human-readable labels) showed the raw
value (e.g. "vault-transit", "async", "Ki") until the dropdown was
first opened.

Pass the current label as SelectValue children, falling back to the
placeholder when no value is selected, across the SSE KMS backend
select, bucket policy/encryption/KMS-key selects, lifecycle object
version selects, site replication sync/TLS selects, and bucket
replication mode/TLS/bandwidth-unit selects.

Selects whose labels equal their values (event ARNs, storage classes,
lifecycle tiers, pagination sizes) are unchanged.
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.

1 participant