downshift 1.31.15 → 1.31.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,7 @@ autocomplete/dropdown/select/combobox components</p>
19
19
  [![downloads][downloads-badge]][npmcharts] [![version][version-badge]][package]
20
20
  [![MIT License][license-badge]][license]
21
21
 
22
- [![All Contributors](https://img.shields.io/badge/all_contributors-78-orange.svg?style=flat-square)](#contributors)
22
+ [![All Contributors](https://img.shields.io/badge/all_contributors-79-orange.svg?style=flat-square)](#contributors)
23
23
  [![PRs Welcome][prs-badge]][prs] [![Chat][chat-badge]][chat]
24
24
  [![Code of Conduct][coc-badge]][coc]
25
25
 
@@ -56,55 +56,54 @@ harder to contribute to.
56
56
  ## Table of Contents
57
57
 
58
58
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
59
-
60
59
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
61
60
 
62
- * [Installation](#installation)
63
- * [Usage](#usage)
64
- * [Props](#props)
65
- * [defaultSelectedItem](#defaultselecteditem)
66
- * [defaultHighlightedIndex](#defaulthighlightedindex)
67
- * [defaultInputValue](#defaultinputvalue)
68
- * [defaultIsOpen](#defaultisopen)
69
- * [itemToString](#itemtostring)
70
- * [selectedItemChanged](#selecteditemchanged)
71
- * [getA11yStatusMessage](#geta11ystatusmessage)
72
- * [onChange](#onchange)
73
- * [onSelect](#onselect)
74
- * [onStateChange](#onstatechange)
75
- * [stateReducer](#statereducer)
76
- * [onInputValueChange](#oninputvaluechange)
77
- * [itemCount](#itemcount)
78
- * [highlightedIndex](#highlightedindex)
79
- * [inputValue](#inputvalue)
80
- * [isOpen](#isopen)
81
- * [selectedItem](#selecteditem)
82
- * [render](#render)
83
- * [id](#id)
84
- * [environment](#environment)
85
- * [onOuterClick](#onouterclick)
86
- * [stateChangeTypes](#statechangetypes)
87
- * [Control Props](#control-props)
88
- * [Render Prop Function](#render-prop-function)
89
- * [prop getters](#prop-getters)
90
- * [actions](#actions)
91
- * [state](#state)
92
- * [props](#props)
93
- * [Event Handlers](#event-handlers)
94
- * [default handlers](#default-handlers)
95
- * [customizing handlers](#customizing-handlers)
96
- * [Utilities](#utilities)
97
- * [resetIdCounter](#resetidcounter)
98
- * [React Native](#react-native)
99
- * [Gotchas](#gotchas)
100
- * [Examples](#examples)
101
- * [FAQ](#faq)
102
- * [Upcoming Breaking Changes](#upcoming-breaking-changes)
103
- * [Inspiration](#inspiration)
104
- * [Other Solutions](#other-solutions)
105
- * [Bindings for ReasonML](#bindings-for-reasonml)
106
- * [Contributors](#contributors)
107
- * [LICENSE](#license)
61
+ - [Installation](#installation)
62
+ - [Usage](#usage)
63
+ - [Props](#props)
64
+ - [defaultSelectedItem](#defaultselecteditem)
65
+ - [defaultHighlightedIndex](#defaulthighlightedindex)
66
+ - [defaultInputValue](#defaultinputvalue)
67
+ - [defaultIsOpen](#defaultisopen)
68
+ - [itemToString](#itemtostring)
69
+ - [selectedItemChanged](#selecteditemchanged)
70
+ - [getA11yStatusMessage](#geta11ystatusmessage)
71
+ - [onChange](#onchange)
72
+ - [onSelect](#onselect)
73
+ - [onStateChange](#onstatechange)
74
+ - [stateReducer](#statereducer)
75
+ - [onInputValueChange](#oninputvaluechange)
76
+ - [itemCount](#itemcount)
77
+ - [highlightedIndex](#highlightedindex)
78
+ - [inputValue](#inputvalue)
79
+ - [isOpen](#isopen)
80
+ - [selectedItem](#selecteditem)
81
+ - [render](#render)
82
+ - [id](#id)
83
+ - [environment](#environment)
84
+ - [onOuterClick](#onouterclick)
85
+ - [stateChangeTypes](#statechangetypes)
86
+ - [Control Props](#control-props)
87
+ - [Render Prop Function](#render-prop-function)
88
+ - [prop getters](#prop-getters)
89
+ - [actions](#actions)
90
+ - [state](#state)
91
+ - [props](#props)
92
+ - [Event Handlers](#event-handlers)
93
+ - [default handlers](#default-handlers)
94
+ - [customizing handlers](#customizing-handlers)
95
+ - [Utilities](#utilities)
96
+ - [resetIdCounter](#resetidcounter)
97
+ - [React Native](#react-native)
98
+ - [Gotchas](#gotchas)
99
+ - [Examples](#examples)
100
+ - [FAQ](#faq)
101
+ - [Upcoming Breaking Changes](#upcoming-breaking-changes)
102
+ - [Inspiration](#inspiration)
103
+ - [Other Solutions](#other-solutions)
104
+ - [Bindings for ReasonML](#bindings-for-reasonml)
105
+ - [Contributors](#contributors)
106
+ - [LICENSE](#license)
108
107
 
109
108
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
110
109
 
@@ -269,8 +268,8 @@ Called when the user selects an item and the selected item has changed. Called
269
268
  with the item that was selected and the new state of `downshift`. (see
270
269
  `onStateChange` for more info on `stateAndHelpers`).
271
270
 
272
- * `selectedItem`: The item that was just selected
273
- * `stateAndHelpers`: This is the same thing your `render` prop function is
271
+ - `selectedItem`: The item that was just selected
272
+ - `stateAndHelpers`: This is the same thing your `render` prop function is
274
273
  called with (see [Render Prop Function](#render-prop-function))
275
274
 
276
275
  ### onSelect
@@ -282,8 +281,8 @@ Called when the user selects an item, regardless of the previous selected item.
282
281
  Called with the item that was selected and the new state of `downshift`. (see
283
282
  `onStateChange` for more info on `stateAndHelpers`).
284
283
 
285
- * `selectedItem`: The item that was just selected
286
- * `stateAndHelpers`: This is the same thing your `render` prop function is
284
+ - `selectedItem`: The item that was just selected
285
+ - `stateAndHelpers`: This is the same thing your `render` prop function is
287
286
  called with (see [Render Prop Function](#render-prop-function))
288
287
 
289
288
  ### onStateChange
@@ -298,10 +297,10 @@ pass it as props, rather than letting downshift control all its state itself.
298
297
  The parameters both take the shape of internal state (`{highlightedIndex: number, inputValue: string, isOpen: boolean, selectedItem: any}`) but differ
299
298
  slightly.
300
299
 
301
- * `changes`: These are the properties that actually have changed since the last
300
+ - `changes`: These are the properties that actually have changed since the last
302
301
  state change. This also has a `type` property which you can learn more about
303
302
  in the [`stateChangeTypes`](#statechangetypes) section.
304
- * `stateAndHelpers`: This is the exact same thing your `render` prop function is
303
+ - `stateAndHelpers`: This is the exact same thing your `render` prop function is
305
304
  called with (see [Render Prop Function](#render-prop-function))
306
305
 
307
306
  > Tip: This function will be called any time _any_ state is changed. The best
@@ -321,8 +320,8 @@ control over how the component interacts with user updates without having to
321
320
  use [Control Props](#control-props). It gives you the current state and the
322
321
  state that will be set, and you return the state that you want to set.
323
322
 
324
- * `state`: The full current state of downshift.
325
- * `changes`: These are the properties that are about to change. This also has a
323
+ - `state`: The full current state of downshift.
324
+ - `changes`: These are the properties that are about to change. This also has a
326
325
  `type` property which you can learn more about in the
327
326
  [`stateChangeTypes`](#statechangetypes) section.
328
327
 
@@ -357,8 +356,8 @@ Called whenever the input value changes. Useful to use instead or in combination
357
356
  of `onStateChange` when `inputValue` is a controlled prop to
358
357
  [avoid issues with cursor positions](https://github.com/paypal/downshift/issues/217).
359
358
 
360
- * `inputValue`: The current value of the input
361
- * `stateAndHelpers`: This is the same thing your `render` prop function is
359
+ - `inputValue`: The current value of the input
360
+ - `stateAndHelpers`: This is the same thing your `render` prop function is
362
361
  called with (see [Render Prop Function](#render-prop-function))
363
362
 
364
363
  ### itemCount
@@ -526,7 +525,7 @@ your root element.
526
525
 
527
526
  Required properties:
528
527
 
529
- * `refKey`: if you're rendering a composite component, that component will need
528
+ - `refKey`: if you're rendering a composite component, that component will need
530
529
  to accept a prop which it forwards to the root DOM element. Commonly, folks
531
530
  call this `innerRef`. So you'd call: `getRootProps({refKey: 'innerRef'})` and
532
531
  your composite component would forward like: `<div ref={props.innerRef} />`
@@ -551,7 +550,7 @@ There are no required properties for this method.
551
550
 
552
551
  Optional properties:
553
552
 
554
- * `disabled`: If this is set to true, then no event handlers will be returned from `getInputProps` and a `disabled` prop will be returned (effectively disabling the input).
553
+ - `disabled`: If this is set to true, then no event handlers will be returned from `getInputProps` and a `disabled` prop will be returned (effectively disabling the input).
555
554
 
556
555
  #### `getLabelProps`
557
556
 
@@ -602,18 +601,18 @@ items.filter(shouldRenderItem).map(item => <div {...getItemProps({item})} />)
602
601
 
603
602
  Required properties:
604
603
 
605
- * `item`: this is the item data that will be selected when the user selects a
604
+ - `item`: this is the item data that will be selected when the user selects a
606
605
  particular item.
607
606
 
608
607
  Optional properties:
609
608
 
610
- * `index`: This is how `downshift` keeps track of your item when updating the
609
+ - `index`: This is how `downshift` keeps track of your item when updating the
611
610
  `highlightedIndex` as the user keys around. By default, `downshift` will
612
611
  assume the `index` is the order in which you're calling `getItemProps`. This
613
612
  is often good enough, but if you find odd behavior, try setting this
614
613
  explicitly. It's probably best to be explicit about `index` when using a
615
614
  windowing library like `react-virtualized`.
616
- * `disabled`: If this is set to `true`, then all of the downshift item event
615
+ - `disabled`: If this is set to `true`, then all of the downshift item event
617
616
  handlers will be omitted. Items will not be highlighted when hovered,
618
617
  and items will not be selected when clicked.
619
618
 
@@ -626,9 +625,9 @@ apply all of the proper ARIA attributes.
626
625
 
627
626
  Optional properties:
628
627
 
629
- * `disabled`: If this is set to `true`, then all of the downshift button event
628
+ - `disabled`: If this is set to `true`, then all of the downshift button event
630
629
  handlers will be omitted (it wont toggle the menu when clicked).
631
- * `aria-label`: The `aria-label` prop is in English. You should probably override
630
+ - `aria-label`: The `aria-label` prop is in English. You should probably override
632
631
  this yourself so you can provide translations:
633
632
 
634
633
  ```jsx
@@ -692,23 +691,23 @@ described below.
692
691
 
693
692
  ### default handlers
694
693
 
695
- * `ArrowDown`: moves the highlighted index down by 1. If this shift key is held
694
+ - `ArrowDown`: moves the highlighted index down by 1. If this shift key is held
696
695
  when this event fires, the highlighted index will jump down 5 indices instead of 1.
697
696
  NOTE: if the current highlighed index is within the bottom 5 indices, the top-most
698
697
  index will be highlighted.)
699
698
 
700
- * `ArrowUp`: moves the highlighted index up by 1. If this shift key is held when
699
+ - `ArrowUp`: moves the highlighted index up by 1. If this shift key is held when
701
700
  this event fires, the highlighted index will jump up 5 indices instead of 1. NOTE:
702
701
  if the current highlighed index is within the top 5 indices, the bottom-most index
703
702
  will be highlighted.)
704
703
 
705
- * `Enter`: if the menu is open, select the currently highlighted item. If the menu
704
+ - `Enter`: if the menu is open, select the currently highlighted item. If the menu
706
705
  is open, the usual 'Enter' event is prevented by Downshift's default implicit enter
707
706
  handler; so, for example, a form submission event will not work as one might expect
708
707
  (though if the menu is closed the form submission will work normally). See below
709
708
  for customizing the handlers.
710
709
 
711
- * `Escape`: will reset downshift's state. This means that `highlightedIndex` will be
710
+ - `Escape`: will reset downshift's state. This means that `highlightedIndex` will be
712
711
  set to the `defaultHighlightedIndex`, the `inputValue` will be set to the `itemToString`
713
712
  value of the `selectedItem`, and the `isOpen` state will be set to `false`.
714
713
 
@@ -793,42 +792,43 @@ Since Downshift renders it's UI using render props, Downshift supports rendering
793
792
 
794
793
  ### Gotchas
795
794
 
796
- * Your root view will need to either pass a ref to `getRootProps` or call `getRootProps` with `{ suppressRefError: true }`. This ref is used to catch a common set of errors around composite components. [Learn more in `getRootProps`](#getrootprops).
797
- * When using a `<FlatList>` or `<ScrollView>`, be sure to supply the [`keyboardShouldPersistTaps`](https://facebook.github.io/react-native/docs/scrollview.html#keyboardshouldpersisttaps) prop to ensure that your text input stays focus, while allowing for taps on the touchables rendered for your items.
795
+ - Your root view will need to either pass a ref to `getRootProps` or call `getRootProps` with `{ suppressRefError: true }`. This ref is used to catch a common set of errors around composite components. [Learn more in `getRootProps`](#getrootprops).
796
+ - When using a `<FlatList>` or `<ScrollView>`, be sure to supply the [`keyboardShouldPersistTaps`](https://facebook.github.io/react-native/docs/scrollview.html#keyboardshouldpersisttaps) prop to ensure that your text input stays focus, while allowing for taps on the touchables rendered for your items.
798
797
 
799
798
  ## Examples
800
799
 
801
800
  Examples exist on [codesandbox.io][examples]:
802
801
 
803
- * [Bare bones autocomplete](https://codesandbox.io/s/6z67jvklw3)
804
- * [Multiple selection](https://codesandbox.io/s/W6gyJ30kn) (uses controlled
802
+ - [Bare bones autocomplete](https://codesandbox.io/s/6z67jvklw3)
803
+ - [Multiple selection](https://codesandbox.io/s/W6gyJ30kn) (uses controlled
805
804
  `selectedItem` API).
806
- * [Type Ahead Example](https://codesandbox.io/s/82m2px40q9) (uses controlled
805
+ - [Type Ahead Example](https://codesandbox.io/s/82m2px40q9) (uses controlled
807
806
  `selectedItem` API).
808
- * [Integration with Apollo](https://codesandbox.io/s/m5zrvqj85p)
809
- * [Integration with Redux](https://codesandbox.io/s/3ywmnyr0zq)
810
- * [Integration with `react-instantsearch`](https://codesandbox.io/s/kvn0lpp83)
807
+ - [Integration with Apollo](https://codesandbox.io/s/m5zrvqj85p)
808
+ - [Integration with Redux](https://codesandbox.io/s/3ywmnyr0zq)
809
+ - [Integration with `react-instantsearch`](https://codesandbox.io/s/kvn0lpp83)
811
810
  from Algolia
812
- * [Material-UI (1.0.0-beta.4) Combobox Using Downshift](https://codesandbox.io/s/QMGq4kAY)
813
- * [Material-UI (1.0.0-beta.33) Multiple select with autocomplete](https://codesandbox.io/s/7k3674z09q)
814
- * [Integration with `GenieJS`](https://codesandbox.io/s/jRLKrxwgl)
811
+ - [Material-UI (1.0.0-beta.4) Combobox Using Downshift](https://codesandbox.io/s/QMGq4kAY)
812
+ - [Material-UI (1.0.0-beta.33) Multiple select with autocomplete](https://codesandbox.io/s/7k3674z09q)
813
+ - [Integration with `GenieJS`](https://codesandbox.io/s/jRLKrxwgl)
815
814
  ([learn more about `genie` here](https://github.com/kentcdodds/genie))
816
- * [Handling and displaying errors](https://codesandbox.io/s/zKE37vorr)
817
- * [Integration with React Router](https://codesandbox.io/s/ww9lwloy8w)
818
- * [Windowing with `react-tiny-virtual-list`](https://codesandbox.io/s/v670kq95l)
819
- * [Section/option group example](https://codesandbox.io/s/zx1kj58npl)
820
- * [Integration with `fuzzaldrin-plus` (Fuzzy matching)](https://codesandbox.io/s/pyq3v4o3j)
821
- * [Dropdown/select implementation with Bootstrap](https://codesandbox.io/s/53y8jvpj0k)
822
- * [Multiple editable tag selection](https://codesandbox.io/s/o4yp9vmm8z)
823
- * [Downshift implemented as compound components and a Higher Order Component](https://codesandbox.io/s/017n1jqo00)
815
+ - [Handling and displaying errors](https://codesandbox.io/s/zKE37vorr)
816
+ - [Integration with React Router](https://codesandbox.io/s/ww9lwloy8w)
817
+ - [Windowing with `react-tiny-virtual-list`](https://codesandbox.io/s/v670kq95l)
818
+ - [Section/option group example](https://codesandbox.io/s/zx1kj58npl)
819
+ - [Integration with `fuzzaldrin-plus` (Fuzzy matching)](https://codesandbox.io/s/pyq3v4o3j)
820
+ - [Dropdown/select implementation with Bootstrap](https://codesandbox.io/s/53y8jvpj0k)
821
+ - [Multiple editable tag selection](https://codesandbox.io/s/o4yp9vmm8z)
822
+ - [Downshift implemented as compound components and a Higher Order Component](https://codesandbox.io/s/017n1jqo00)
824
823
  (exposes a `withDownshift` higher order component which you can use to get at
825
824
  the state, actions, prop getters in a rendered downshift tree).
826
- * [Downshift Spectre.css example](https://codesandbox.io/s/M89KQOBRB)
827
- * [Integration with `redux-form`](https://codesandbox.io/s/k594964z13)
828
- * [Integration with `react-final-form`](https://codesandbox.io/s/qzm43nn2mj)
829
- * [Provider Pattern](https://codesandbox.io/s/mywzk3133p) - how to avoid prop-drilling if you like to break up your render method into more components
830
- * [React Native example](https://snack.expo.io/SkE0LxXqM)
831
- * [React VR example](https://github.com/infiniteluke/bassdrop)
825
+ - [Downshift Spectre.css example](https://codesandbox.io/s/M89KQOBRB)
826
+ - [Integration with `redux-form`](https://codesandbox.io/s/k594964z13)
827
+ - [Integration with `react-final-form`](https://codesandbox.io/s/qzm43nn2mj)
828
+ - [Provider Pattern](https://codesandbox.io/s/mywzk3133p) - how to avoid prop-drilling if you like to break up your render method into more components
829
+ - [React Native example](https://snack.expo.io/SkE0LxXqM)
830
+ - [React VR example](https://github.com/infiniteluke/bassdrop)
831
+ - [Multiple checkbox selection](https://codesandbox.io/s/5z711pmr3l)
832
832
 
833
833
  If you would like to add an example, follow these steps:
834
834
 
@@ -925,8 +925,8 @@ Autocomplete][jquery-complete].
925
925
 
926
926
  You can watch me build the first iteration of `downshift` on YouTube:
927
927
 
928
- * [Part 1](https://www.youtube.com/watch?v=2kzD1IjDy5s&list=PLV5CVI1eNcJh5CTgArGVwANebCrAh2OUE&index=11)
929
- * [Part 2](https://www.youtube.com/watch?v=w1Z7Jvj08_s&list=PLV5CVI1eNcJh5CTgArGVwANebCrAh2OUE&index=10)
928
+ - [Part 1](https://www.youtube.com/watch?v=2kzD1IjDy5s&list=PLV5CVI1eNcJh5CTgArGVwANebCrAh2OUE&index=11)
929
+ - [Part 2](https://www.youtube.com/watch?v=w1Z7Jvj08_s&list=PLV5CVI1eNcJh5CTgArGVwANebCrAh2OUE&index=10)
930
930
 
931
931
  You'll find more recordings of me working on `downshift` on [my livestream
932
932
  YouTube playlist][yt-playlist].
@@ -936,8 +936,8 @@ YouTube playlist][yt-playlist].
936
936
  You can implement these other solutions using `downshift`, but if you'd prefer
937
937
  to use these out of the box solutions, then that's fine too:
938
938
 
939
- * [`react-select`](https://github.com/JedWatson/react-select)
940
- * [`react-autocomplete`](https://github.com/reactjs/react-autocomplete)
939
+ - [`react-select`](https://github.com/JedWatson/react-select)
940
+ - [`react-autocomplete`](https://github.com/reactjs/react-autocomplete)
941
941
 
942
942
  ## Bindings for ReasonML
943
943
 
@@ -948,7 +948,6 @@ If you're developing some React in ReasonML, check out the [`Downshift` bindings
948
948
  Thanks goes to these people ([emoji key][emojis]):
949
949
 
950
950
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
951
-
952
951
  <!-- prettier-ignore -->
953
952
  | [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/paypal/downshift/commits?author=kentcdodds "Code") [📖](https://github.com/paypal/downshift/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/paypal/downshift/commits?author=kentcdodds "Tests") [👀](#review-kentcdodds "Reviewed Pull Requests") [📝](#blog-kentcdodds "Blogposts") [🐛](https://github.com/paypal/downshift/issues?q=author%3Akentcdodds "Bug reports") [💡](#example-kentcdodds "Examples") [🤔](#ideas-kentcdodds "Ideas, Planning, & Feedback") [📢](#talk-kentcdodds "Talks") | [<img src="https://avatars0.githubusercontent.com/u/100200?v=4" width="100px;"/><br /><sub><b>Ryan Florence</b></sub>](http://twitter.com/ryanflorence)<br />[🤔](#ideas-ryanflorence "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/112170?v=4" width="100px;"/><br /><sub><b>Jared Forsyth</b></sub>](http://jaredforsyth.com)<br />[🤔](#ideas-jaredly "Ideas, Planning, & Feedback") [📖](https://github.com/paypal/downshift/commits?author=jaredly "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/8162598?v=4" width="100px;"/><br /><sub><b>Jack Moore</b></sub>](https://github.com/jtmthf)<br />[💡](#example-jtmthf "Examples") | [<img src="https://avatars1.githubusercontent.com/u/2762082?v=4" width="100px;"/><br /><sub><b>Travis Arnold</b></sub>](http://travisrayarnold.com)<br />[💻](https://github.com/paypal/downshift/commits?author=souporserious "Code") [📖](https://github.com/paypal/downshift/commits?author=souporserious "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/1045233?v=4" width="100px;"/><br /><sub><b>Marcy Sutton</b></sub>](http://marcysutton.com)<br />[🐛](https://github.com/paypal/downshift/issues?q=author%3Amarcysutton "Bug reports") [🤔](#ideas-marcysutton "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/244704?v=4" width="100px;"/><br /><sub><b>Jeremy Gayed</b></sub>](http://www.jeremygayed.com)<br />[💡](#example-tizmagik "Examples") |
954
953
  | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
@@ -962,7 +961,7 @@ Thanks goes to these people ([emoji key][emojis]):
962
961
  | [<img src="https://avatars0.githubusercontent.com/u/410792?v=4" width="100px;"/><br /><sub><b>Dony Sukardi</b></sub>](http://dsds.io)<br />[💡](#example-donysukardi "Examples") [💬](#question-donysukardi "Answering Questions") [💻](https://github.com/paypal/downshift/commits?author=donysukardi "Code") [⚠️](https://github.com/paypal/downshift/commits?author=donysukardi "Tests") | [<img src="https://avatars1.githubusercontent.com/u/2755722?v=4" width="100px;"/><br /><sub><b>Dillon Mulroy</b></sub>](https://dillonmulroy.com)<br />[📖](https://github.com/paypal/downshift/commits?author=dmmulroy "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/12440573?v=4" width="100px;"/><br /><sub><b>Curtis Tate Wilkinson</b></sub>](https://twitter.com/curtytate)<br />[💻](https://github.com/paypal/downshift/commits?author=curtiswilkinson "Code") | [<img src="https://avatars3.githubusercontent.com/u/383212?v=4" width="100px;"/><br /><sub><b>Brice BERNARD</b></sub>](https://github.com/brikou)<br />[🐛](https://github.com/paypal/downshift/issues?q=author%3Abrikou "Bug reports") [💻](https://github.com/paypal/downshift/commits?author=brikou "Code") | [<img src="https://avatars3.githubusercontent.com/u/14304503?v=4" width="100px;"/><br /><sub><b>Tony Xu</b></sub>](https://github.com/xutopia)<br />[💻](https://github.com/paypal/downshift/commits?author=xutopia "Code") | [<img src="https://avatars1.githubusercontent.com/u/14035529?v=4" width="100px;"/><br /><sub><b>Anthony Ng</b></sub>](http://anthonyng.me)<br />[📖](https://github.com/paypal/downshift/commits?author=newyork-anthonyng "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/11996139?v=4" width="100px;"/><br /><sub><b>S S</b></sub>](https://github.com/notruth)<br />[💬](#question-notruth "Answering Questions") [💻](https://github.com/paypal/downshift/commits?author=notruth "Code") [📖](https://github.com/paypal/downshift/commits?author=notruth "Documentation") [🤔](#ideas-notruth "Ideas, Planning, & Feedback") [⚠️](https://github.com/paypal/downshift/commits?author=notruth "Tests") |
963
962
  | [<img src="https://avatars0.githubusercontent.com/u/29493001?v=4" width="100px;"/><br /><sub><b>Austin Tackaberry</b></sub>](http://austintackaberry.co)<br />[💬](#question-austintackaberry "Answering Questions") [💻](https://github.com/paypal/downshift/commits?author=austintackaberry "Code") [📖](https://github.com/paypal/downshift/commits?author=austintackaberry "Documentation") [🐛](https://github.com/paypal/downshift/issues?q=author%3Aaustintackaberry "Bug reports") [💡](#example-austintackaberry "Examples") [🤔](#ideas-austintackaberry "Ideas, Planning, & Feedback") [👀](#review-austintackaberry "Reviewed Pull Requests") [⚠️](https://github.com/paypal/downshift/commits?author=austintackaberry "Tests") | [<img src="https://avatars3.githubusercontent.com/u/4168055?v=4" width="100px;"/><br /><sub><b>Jean Duthon</b></sub>](https://github.com/jduthon)<br />[🐛](https://github.com/paypal/downshift/issues?q=author%3Ajduthon "Bug reports") [💻](https://github.com/paypal/downshift/commits?author=jduthon "Code") | [<img src="https://avatars3.githubusercontent.com/u/3889580?v=4" width="100px;"/><br /><sub><b>Anton Telesh</b></sub>](http://antontelesh.github.io)<br />[🐛](https://github.com/paypal/downshift/issues?q=author%3AAntontelesh "Bug reports") [💻](https://github.com/paypal/downshift/commits?author=Antontelesh "Code") | [<img src="https://avatars3.githubusercontent.com/u/1060669?v=4" width="100px;"/><br /><sub><b>Eric Edem</b></sub>](https://github.com/ericedem)<br />[💻](https://github.com/paypal/downshift/commits?author=ericedem "Code") [📖](https://github.com/paypal/downshift/commits?author=ericedem "Documentation") [🤔](#ideas-ericedem "Ideas, Planning, & Feedback") [⚠️](https://github.com/paypal/downshift/commits?author=ericedem "Tests") | [<img src="https://avatars3.githubusercontent.com/u/3409645?v=4" width="100px;"/><br /><sub><b>Austin Wood</b></sub>](https://github.com/indiesquidge)<br />[💬](#question-indiesquidge "Answering Questions") [📖](https://github.com/paypal/downshift/commits?author=indiesquidge "Documentation") [👀](#review-indiesquidge "Reviewed Pull Requests") | [<img src="https://avatars3.githubusercontent.com/u/14275790?v=4" width="100px;"/><br /><sub><b>Mark Murray</b></sub>](https://github.com/mmmurray)<br />[🚇](#infra-mmmurray "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars0.githubusercontent.com/u/1862172?v=4" width="100px;"/><br /><sub><b>Gianmarco</b></sub>](https://github.com/gsimone)<br />[🐛](https://github.com/paypal/downshift/issues?q=author%3Agsimone "Bug reports") [💻](https://github.com/paypal/downshift/commits?author=gsimone "Code") |
964
963
  | [<img src="https://avatars2.githubusercontent.com/u/6838136?v=4" width="100px;"/><br /><sub><b>Emmanuel Pastor</b></sub>](https://github.com/pastr)<br />[💡](#example-pastr "Examples") | [<img src="https://avatars2.githubusercontent.com/u/10345034?v=4" width="100px;"/><br /><sub><b>dalehurwitz</b></sub>](https://github.com/dalehurwitz)<br />[💻](https://github.com/paypal/downshift/commits?author=dalehurwitz "Code") | [<img src="https://avatars1.githubusercontent.com/u/4813007?v=4" width="100px;"/><br /><sub><b>Bogdan Lobor</b></sub>](https://github.com/blobor)<br />[🐛](https://github.com/paypal/downshift/issues?q=author%3Ablobor "Bug reports") [💻](https://github.com/paypal/downshift/commits?author=blobor "Code") | [<img src="https://avatars0.githubusercontent.com/u/1127238?v=4" width="100px;"/><br /><sub><b>Luke Herrington</b></sub>](https://github.com/infiniteluke)<br />[💡](#example-infiniteluke "Examples") | [<img src="https://avatars2.githubusercontent.com/u/6361167?v=4" width="100px;"/><br /><sub><b>Brandon Clemons</b></sub>](https://github.com/drobannx)<br />[💻](https://github.com/paypal/downshift/commits?author=drobannx "Code") | [<img src="https://avatars0.githubusercontent.com/u/10591587?v=4" width="100px;"/><br /><sub><b>Kieran</b></sub>](https://github.com/aMollusk)<br />[💻](https://github.com/paypal/downshift/commits?author=aMollusk "Code") | [<img src="https://avatars3.githubusercontent.com/u/11570627?v=4" width="100px;"/><br /><sub><b>Brushedoctopus</b></sub>](https://github.com/Brushedoctopus)<br />[🐛](https://github.com/paypal/downshift/issues?q=author%3ABrushedoctopus "Bug reports") [💻](https://github.com/paypal/downshift/commits?author=Brushedoctopus "Code") |
965
- | [<img src="https://avatars3.githubusercontent.com/u/5456216?v=4" width="100px;"/><br /><sub><b>Cameron Edwards</b></sub>](http://cameronpedwards.com)<br />[💻](https://github.com/paypal/downshift/commits?author=cameronprattedwards "Code") |
964
+ | [<img src="https://avatars3.githubusercontent.com/u/5456216?v=4" width="100px;"/><br /><sub><b>Cameron Edwards</b></sub>](http://cameronpedwards.com)<br />[💻](https://github.com/paypal/downshift/commits?author=cameronprattedwards "Code") | [<img src="https://avatars0.githubusercontent.com/u/7252803?v=4" width="100px;"/><br /><sub><b>Alfred Ringstad</b></sub>](https://hyperlab.se)<br />[💻](https://github.com/paypal/downshift/commits?author=alfredringstad "Code") |
966
965
 
967
966
  <!-- ALL-CONTRIBUTORS-LIST:END -->
968
967
 
@@ -1092,12 +1092,14 @@ var _initialiseProps = function () {
1092
1092
  }
1093
1093
  };
1094
1094
 
1095
- this.button_handleBlur = function () {
1095
+ this.button_handleBlur = function (event) {
1096
+ var blurTarget = event.target; // Save blur target for comparison with activeElement later
1096
1097
  // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
1097
1098
  setTimeout(function () {
1098
- if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId)) {
1099
- _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
1100
- }
1099
+ if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId) && _this4.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
1100
+ ) {
1101
+ _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
1102
+ }
1101
1103
  });
1102
1104
  };
1103
1105
 
@@ -1087,12 +1087,14 @@ var _initialiseProps = function () {
1087
1087
  }
1088
1088
  };
1089
1089
 
1090
- this.button_handleBlur = function () {
1090
+ this.button_handleBlur = function (event) {
1091
+ var blurTarget = event.target; // Save blur target for comparison with activeElement later
1091
1092
  // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
1092
1093
  setTimeout(function () {
1093
- if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId)) {
1094
- _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
1095
- }
1094
+ if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId) && _this4.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
1095
+ ) {
1096
+ _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
1097
+ }
1096
1098
  });
1097
1099
  };
1098
1100
 
@@ -929,12 +929,14 @@ var _initialiseProps = function () {
929
929
  }
930
930
  };
931
931
 
932
- this.button_handleBlur = function () {
932
+ this.button_handleBlur = function (event) {
933
+ var blurTarget = event.target; // Save blur target for comparison with activeElement later
933
934
  // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
934
935
  setTimeout(function () {
935
- if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId)) {
936
- _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
937
- }
936
+ if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId) && _this4.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
937
+ ) {
938
+ _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
939
+ }
938
940
  });
939
941
  };
940
942
 
@@ -1090,12 +1090,14 @@
1090
1090
  });
1091
1091
  };
1092
1092
 
1093
- this.button_handleBlur = function () {
1093
+ this.button_handleBlur = function (event) {
1094
+ var blurTarget = event.target; // Save blur target for comparison with activeElement later
1094
1095
  // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
1095
1096
  setTimeout(function () {
1096
- if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId)) {
1097
- _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
1098
- }
1097
+ if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId) && _this4.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
1098
+ ) {
1099
+ _this4.reset({ type: Downshift.stateChangeTypes.blurButton });
1100
+ }
1099
1101
  });
1100
1102
  };
1101
1103