Skip to content

Commit

Permalink
docs: align docs with v7 (#1451)
Browse files Browse the repository at this point in the history
* docs: remove reference to usage of shift modifier with arrow keys + fix typo

* docs: update stateChangeTypes examples to align with v7
  • Loading branch information
YaseenAlGailani authored Dec 17, 2022
1 parent d62ba91 commit 795a8d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions src/hooks/useCombobox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,15 @@ properties:
Called each time the highlighted item was changed. Items can be highlighted
while hovering the mouse over them or by keyboard keys such as Up Arrow, Down
Arrow, Home and End. Arrow keys can be combined with Shift to move by a step of
5 positions instead of 1. Items can also be highlighted by hitting character
keys that are part of their starting string equivalent.
Arrow, Home and End. Items can also be highlighted by hitting character keys
that are part of their starting string equivalent.

- `changes`: These are the properties that actually have changed since the last
state change. This object is guaranteed to contain the `highlightedIndex`
property with the new value. This also has a `type` property which you can
learn more about in the [`stateChangeTypes`](#statechangetypes) section. This
property will be part of the actions that can trigger a `highlightedIndex`
change, for example `useCombobox.stateChangeTypes.MenuKeyDownArrowUp`.
change, for example `useCombobox.stateChangeTypes.InputKeyDownArrowUp`.

### onIsOpenChange

Expand Down Expand Up @@ -640,8 +639,8 @@ that state from other components, `redux`, `react-router`, or anywhere else.

> Note: This is very similar to how normal controlled components work elsewhere
> in react (like `<input />`). If you want to learn more about this concept, you
> can learn about that from this the
> [Advanced React Component Patterns course][advanced-react-component-patterns-course]
> can learn about that from the [Advanced React Component Patterns
> course][advanced-react-component-patterns-course]
## Returned props

Expand Down Expand Up @@ -1064,6 +1063,7 @@ suggestion and the Codesandbox for it, and we will take it from there.
https://blog.kentcdodds.com/how-to-give-rendering-control-to-users-with-prop-getters-549eaef76acf
[docsite]: https://downshift-js.com/
[sandbox-repo]: https://codesandbox.io/s/github/kentcdodds/downshift-examples
[advanced-react-component-patterns-course]: https://github.com/downshift-js/downshift#advanced-react-component-patterns-course
[advanced-react-component-patterns-course]:
https://github.com/downshift-js/downshift#advanced-react-component-patterns-course
[migration-guide-v7]:
https://github.com/downshift-js/downshift/tree/master/src/hooks/MIGRATION_V7.md#usecombobox
16 changes: 8 additions & 8 deletions src/hooks/useSelect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function stateReducer(state, actionAndChanges) {
const {type, changes} = actionAndChanges
// this prevents the menu from being closed when the user selects an item with 'Enter' or mouse
switch (type) {
case useSelect.stateChangeTypes.MenuKeyDownEnter:
case useSelect.stateChangeTypes.ToggleButtonKeyDownEnter:
case useSelect.stateChangeTypes.ItemClick:
return {
...changes, // default Downshift new state changes on item selection.
Expand Down Expand Up @@ -363,16 +363,15 @@ properties:

Called each time the highlighted item was changed. Items can be highlighted
while hovering the mouse over them or by keyboard keys such as Up Arrow, Down
Arrow, Home and End. Arrow keys can be combined with Shift to move by a step of
5 positions instead of 1. Items can also be highlighted by hitting character
keys that are part of their starting string equivalent.
Arrow, Home and End. Items can also be highlighted by hitting character keys
that are part of their starting string equivalent.

- `changes`: These are the properties that actually have changed since the last
state change. This object is guaranteed to contain the `highlightedIndex`
property with the new value. This also has a `type` property which you can
learn more about in the [`stateChangeTypes`](#statechangetypes) section. This
property will be part of the actions that can trigger a `highlightedIndex`
change, for example `useSelect.stateChangeTypes.MenuKeyDownArrowUp`.
change, for example `useSelect.stateChangeTypes.ToggleButtonKeyDownArrowUp`.

### onIsOpenChange

Expand Down Expand Up @@ -540,8 +539,8 @@ that state from other components, `redux`, `react-router`, or anywhere else.

> Note: This is very similar to how normal controlled components work elsewhere
> in react (like `<input />`). If you want to learn more about this concept, you
> can learn about that from this the
> [Advanced React Component Patterns course][advanced-react-component-patterns-course]
> can learn about that from the [Advanced React Component Patterns
> course][advanced-react-component-patterns-course]

## Returned props

Expand Down Expand Up @@ -937,6 +936,7 @@ suggestion and the Codesandbox for it, and we will take it from there.
https://blog.kentcdodds.com/how-to-give-rendering-control-to-users-with-prop-getters-549eaef76acf
[docsite]: https://downshift-js.com/
[sandbox-repo]: https://codesandbox.io/s/github/kentcdodds/downshift-examples
[advanced-react-component-patterns-course]: https://github.com/downshift-js/downshift#advanced-react-component-patterns-course
[advanced-react-component-patterns-course]:
https://github.com/downshift-js/downshift#advanced-react-component-patterns-course
[migration-guide-v7]:
https://github.com/downshift-js/downshift/tree/master/src/hooks/MIGRATION_V7.md#useselect

0 comments on commit 795a8d1

Please sign in to comment.