fix: render select labels before dropdown opens - #212
Open
reatang wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #211. base-ui's
Select.Valuefalls back to the raw option value when given no children or items mapping, so everySelectValuewithout 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
SelectValueusages without children and passes the current label as children (falling back to the placeholder vianullwhen nothing is selected), following the existing pattern inperformance-server-list.tsx(sortLabels):backendTypeLabelsmap; the original fix: render KMS backend label in closed select #211 scenario, applied here since that fix was not on this branch's base)kmsKeyOptions)versionOptions)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:
BucketPolicyTypeincludes values the policy select does not offer (none,readonly, …) andSiteReplicationSyncStateincludesunknown, so those two label maps usePartial<Record<…>>with a fallback to the raw value / placeholder.Type of Change
Testing
Ran via
corepack pnpm@11.11.0:type-check✅,lint✅,format:check✅ (only the pre-existingcomponents/object/tiff-viewer.tsxfailure on main remains),test:run✅ (401 tests pass).Checklist
Related Issues
Follow-up to #211.
Additional Notes
The fix pattern relies on base-ui behavior: plain
SelectValuechildren override the raw-value fallback, andnullchildren fall through to theplaceholder.