@digitransit-component/digitransit-component-autosuggest 9.0.2 → 9.0.3
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/lib/index.cjs +2 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.development.cjs +7 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -6345,6 +6345,10 @@ function getLabel(properties) {
|
|
|
6345
6345
|
}
|
|
6346
6346
|
}
|
|
6347
6347
|
|
|
6348
|
+
// The scrolling element is the menu's wrapper, outside downshift's menu node.
|
|
6349
|
+
const scrollItemIntoView = node => node.scrollIntoView({
|
|
6350
|
+
block: 'nearest'
|
|
6351
|
+
});
|
|
6348
6352
|
const isKeyboardSelectionEvent = event => {
|
|
6349
6353
|
const space = [13, ' ', 'Spacebar'];
|
|
6350
6354
|
const enter = [32, 'Enter'];
|
|
@@ -6883,6 +6887,7 @@ const MobileView = ({
|
|
|
6883
6887
|
items: state.suggestions,
|
|
6884
6888
|
inputValue: value,
|
|
6885
6889
|
isOpen: true,
|
|
6890
|
+
scrollIntoView: scrollItemIntoView,
|
|
6886
6891
|
onSelectedItemChange: changes => {
|
|
6887
6892
|
onSelectedItemChange(changes);
|
|
6888
6893
|
dispatch({
|
|
@@ -7576,6 +7581,7 @@ function DTAutosuggest({
|
|
|
7576
7581
|
} = useCombobox({
|
|
7577
7582
|
inputId: id,
|
|
7578
7583
|
inputValue: state.value,
|
|
7584
|
+
scrollIntoView: scrollItemIntoView,
|
|
7579
7585
|
defaultHighlightedIndex: 0,
|
|
7580
7586
|
// Typing is dispatched synchronously by Input. Downshift reports it from an
|
|
7581
7587
|
// effect a render late, which would overwrite newer keystrokes.
|