Skip to content

feat: add editable values to Slider and RangeSlider - #10978

Open
reidbarber wants to merge 9 commits into
mainfrom
feat-editable-slider
Open

reidbarber wants to merge 9 commits into
mainfrom
feat-editable-slider

Conversation

@reidbarber

@reidbarber reidbarber commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Closes

Summary

Slider values currently support dragging and keyboard adjustment, but not direct numeric entry. This adds an optional editable field for precise input.

S2 Slider S2 RangeSlider
  • Adds <SliderInput /> composition to Spectrum 2 Slider and RangeSlider, with size-aware styling and a shared field for range endpoints.
  • Supports slotted NumberField composition in RAC, synchronizing values, bounds, steps, formatting, and disabled state.
  • Handles keyboard navigation between range inputs, pending edits before track interaction, and form submission/reset without duplicate entries.

📝 Test Instructions

Test Slider and RangeSlider in S2. Test in RAC with single and multi-thumb support.

Release impact

  • Only changes docs, tests, CI, or development tools. Nothing shipped to users changes.
  • Fixes a bug or improves existing code without changing how apps use it.
  • Adds a feature or API while keeping existing usage working.
  • May break existing usage or require changes in apps that use this code.

✅ PR Checklist

  • I followed the contributing guide.
  • I tested this change locally and included the results in Test Instructions, or explained why testing does not apply.
  • I understand and can explain every change in this PR. If I used AI assistance, I followed the AI contribution guidance.

🧢 Your Project

…ti-thumb RAC support:

- S2: Replaced `isEditable` with `<SliderInput />` in order to keep `AriaNumberField`/`NumberParser` out of non-editable slider bundles. Renders a single field for `Slider` and a shared `start – end` `FieldGroup` (`role="presentation"`) with per-input auto-width sizing inside a fixed-width container for `RangeSlider`.
- RAC: Added RTL-aware `ArrowLeft`/`ArrowRight` boundary focus handoff across slotted `NumberField`s and `GroupContext` disabled propagation.
RAC:
- Bind NumberFields to thumbs only when they have an explicit index slot.
- Label slotted fields with the slider's own labelling ids so an external aria-labelledby is forwarded instead of the group's id.
- Commit pending field text before a track press starts a drag, so the commit no longer ends the gesture or fires onChangeEnd early.
- Avoid instanceof checks so arrow-key and commit work for inputs owned by another window.

Hooks:
- Track thumb editability in state instead of a ref, registered from a layout effect, so the Slider re-renders when a thumb's disabled state changes.

S2:
- Show the value output when a conditional SliderInput is not rendered, e.g. {isEditable && <SliderInput />}.
- Focus the correct range input when clicking the separator in RTL, based on the rendered input positions.
- Use 12px gap for size="S" on slider controls and side labels, and update matching minWidths (including RangeSlider track minWidth)
- Start-align RangeSlider SliderInput values instead of centering
- Apply font-variant-numeric: tabular-nums directly to SliderInput <input> elements
- Focus the nearest range input when clicking or tapping in FieldGroup padding
Keep batched endpoint updates from overwriting each other while
preserving controlled slider drag callbacks.
Inspect nested fragments when detecting editable children so the
standard value output remains visible when no input is rendered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants