Skip to content

fix(select): align contract and runtime behavior#304

Merged
RtlZeroMemory merged 2 commits intomainfrom
fix/select-contract-alignment
Mar 19, 2026
Merged

fix(select): align contract and runtime behavior#304
RtlZeroMemory merged 2 commits intomainfrom
fix/select-contract-alignment

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Mar 19, 2026

Summary

Align the public select contract with the inline cycler runtime by removing an unsupported error prop, unifying placeholder fallback behavior, and updating the docs and catalog to describe the real interaction model.

Problem

select docs described a dropdown-style widget while the shipped runtime behaved like an inline cycler. The public type surface also exposed SelectProps.error even though the renderer never consumed it, and helper logic, renderer output, and focus metadata disagreed about what to show when the current value did not match any option.

Root cause

The contract, docs, and runtime helpers drifted independently. Placeholder fallback behavior was implemented separately in multiple places, and the public type surface kept an unimplemented prop that was never wired through rendering.

Fix

Remove the unsupported SelectProps.error prop, route display text through a single helper for renderer and focus metadata fallback, add regression coverage for Enter and Space advancing the inline cycler and for placeholder fallback in widget metadata, and update the widget docs and catalog to match the controlled inline-cycler API.

Tests

npm install --prefer-offline
npm run lint
npm run typecheck
npm run build
node scripts/run-tests.mjs --filter "formWidgets.test.js"
node scripts/run-tests.mjs --filter "widgetMeta.test.js"
node scripts/run-tests.mjs --filter "widgetRenderer.integration.test.js"
node scripts/run-tests.mjs

Notes

This keeps the existing inline cycler behavior intentionally; it does not introduce popup or overlay behavior.

Summary by CodeRabbit

  • New Features

    • Select widget now cycles through options inline using Enter and Space keys instead of opening a dropdown
    • Added new optional props: focusable, accessibleLabel, focusConfig, dsVariant, dsTone, dsSize
    • onChange is now optional rather than required
  • Bug Fixes

    • Improved display label resolution when selected value has no matching option
  • Tests

    • Added keyboard navigation and focus metadata integration tests

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 19, 2026

Warning

Rate limit exceeded

@RtlZeroMemory has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 20812356-0261-42ce-b73d-f16cbd947eda

📥 Commits

Reviewing files that changed from the base of the PR and between 844e556 and 8536c7c.

📒 Files selected for processing (1)
  • packages/core/etc/core.api.md
📝 Walkthrough

Walkthrough

The select widget API has been restructured: onChange moved from required to optional common props, new focus and accessibility props (focusable, accessibleLabel, focusConfig) added, and DEFAULT_PLACEHOLDER ("Select...") standardized. Display-text resolution logic consolidated into getSelectDisplayText. Widget now documented as an inline selection control that cycles through options via ENTER/SPACE keys.

Changes

Cohort / File(s) Summary
Schema & Documentation
docs/widgets/catalog.json, docs/widgets/select.md
Schema updated: onChange moved to common props, accessibility/design-system props added (focusable, accessibleLabel, focusConfig, dsVariant, dsTone, dsSize). Documentation clarified: select is now an inline control cycling through options; default placeholder changed to "Select..."; ENTER/SPACE advance selection instead of confirming.
Display Logic Consolidation
packages/core/src/renderer/renderToDrawlist/widgets/renderFormWidgets.ts, packages/core/src/runtime/widgetMeta/focusInfo.ts, packages/core/src/widgets/select.ts
Refactored display-label resolution to use centralized getSelectDisplayText helper; fallback chain now uses placeholderDEFAULT_PLACEHOLDER instead of raw value string.
Type Refinement
packages/core/src/widgets/types/forms.ts
Removed error?: boolean prop from SelectProps type definition.
Tests
packages/core/src/app/__tests__/widgetRenderer.integration.test.ts, packages/core/src/runtime/__tests__/widgetMeta.test.ts, packages/core/src/widgets/__tests__/formWidgets.test.ts
Added integration test for keyboard navigation (ENTER/SPACE cycling); added focus-metadata test with placeholder as fallback label; updated existing test expectations for getSelectDisplayText fallback behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A select once strict with rules so tight,
Now bends and cycles—left and right!
With focus bare and labels clear,
Our inline picker's debut here!
No dropdown fuss, just ENTER's call,
A leaner select—the best of all! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main objective: aligning the select widget's contract (types, docs, catalog) with its actual runtime behavior.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/select-contract-alignment
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@RtlZeroMemory RtlZeroMemory merged commit 1da87f8 into main Mar 19, 2026
10 checks passed
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