You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f40ce1b
Browse filesBrowse the repository at this point in the historyBrowse files
Add touch support for accepting ghost suggestions
Changes:
- Accept chip: a 44×44 button floating over the field to accept the full hint
- Tappable ghost words: tap individual words to accept up to them (word-by-word),
same as Ctrl/Cmd+ArrowRight on keyboard
- SSR-safe coarse-pointer detection via matchMedia('(pointer: coarse)')
- Touch-aware helper text that updates screen-reader announcements
- Headless renderTouchAccept prop for custom accept controls
- All touch targets accept on pointerdown + preventDefault to keep editor focus
New props:
- touchAccept?: boolean | 'auto' (default 'auto' = coarse pointers only)
- touchAcceptLabel?: string (accessible label, default 'Accept suggestion')
- touchAcceptClassName?: string (extra classes for chip)
- renderTouchAccept?: (api: TouchAcceptRenderProps) => ReactNode (custom control)
Use this when you want the editable surface without ghost hints.
@@ -762,6 +810,8 @@ in your own stylesheet to re-skin the component.
762
810
|`--ff-key-radius`| Keycap border radius |
763
811
|`--ff-key-font-size`| Keycap text size |
764
812
|`--ff-key-font-weight`| Keycap font weight |
813
+
|`--ff-touch-accept-size`| Touch accept chip target size (default `34px`; set to `44px` for WCAG 2.5.5) |
814
+
|`--ff-touch-accept-glyph-size`| Touch accept chip glyph (↵) text size |
765
815
|`--ff-font`| Font family |
766
816
|`--ff-padding-y`| Vertical padding |
767
817
|`--ff-padding-x`| Horizontal padding |
@@ -811,7 +861,12 @@ Every public prop below includes its use and a short example.
811
861
|`onDismiss`|`() => void`| Runs when Escape hides a visible hint. |`<ForeFill onDismiss={() => track('dismissed')} />`|
812
862
|`acceptOnEnter`|`boolean`, default `true`| When false, Enter commits typed text and Tab accepts hints. |`<ForeFill acceptOnEnter={false} />`|
813
863
|`commitOnBlur`|`boolean`, default `false`| Commits the current value when focus leaves the field. |`<ForeFill commitOnBlur onCommit={save} />`|
814
-
|`partialAccept`|`boolean`, default `true`| Lets users accept one word with Ctrl/Cmd + ArrowRight. |`<ForeFill partialAccept={false} />`|
864
+
|`partialAccept`|`boolean`, default `true`| Lets users accept one word with Ctrl/Cmd + ArrowRight (and by tapping a ghost word on touch). |`<ForeFill partialAccept={false} />`|
|`touchAcceptLabel`|`string`, default `'Accept suggestion'`| Accessible label for the accept chip. |`<ForeFill touchAcceptLabel="Use suggestion" />`|
867
+
|`touchAcceptClassName`|`string`| Extra classes merged onto the accept chip. |`<ForeFill touchAcceptClassName="my-chip" />`|
868
+
|`renderTouchAccept`|`(api: TouchAcceptRenderProps) => ReactNode`| Render your own accept control; call `accept()` from a `preventDefault`-ed `onPointerDown`. | See [Touch Support](#touch-support)|
869
+
|`active`|`boolean`, default `false`| Renders the inline ghost as if focused without stealing DOM focus (avoids opening the soft keyboard on touch). For showcase/preview scenarios with an externally driven value. |`<ForeFill active value={value} suggestions={suggestions} />`|
0 commit comments