@digitransit-component/digitransit-component-autosuggest 11.0.7 → 11.0.9

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.js CHANGED
@@ -16240,6 +16240,13 @@ function DTAutosuggest({
16240
16240
  });
16241
16241
  }
16242
16242
  }, [state.renderMobile, isOpen]);
16243
+
16244
+ // Downshift keeps highlightedIndex when the suggestions change, and the
16245
+ // menu is hidden on mobile, so the highlighted item may not be shown.
16246
+ const activeItemHidden = isMobile || highlightedIndex >= state.suggestions.length;
16247
+ const getComboboxInputProps = props => getInputProps(_objectSpread(_objectSpread({}, props), activeItemHidden && {
16248
+ 'aria-activedescendant': undefined
16249
+ }));
16243
16250
  return /*#__PURE__*/jsxs(Fragment, {
16244
16251
  children: [isMobile && /*#__PURE__*/jsx(MobileView, {
16245
16252
  placeholder: t(placeholder, {
@@ -16276,18 +16283,18 @@ function DTAutosuggest({
16276
16283
  },
16277
16284
  children: [icon && /*#__PURE__*/jsx("div", {
16278
16285
  className: cx(styles['autosuggest-input-icon'], styles[id], inputClassName && styles[`${inputClassName}-input-icon`]),
16279
- "aria-label": ariaRequiredText.concat(' ').concat(SearchBarId).concat(' ').concat(t('search-autosuggest-label', {
16280
- lng
16281
- })),
16286
+ "aria-hidden": "true",
16282
16287
  children: /*#__PURE__*/jsx(Icon, {
16283
16288
  img: `${icon}`
16284
16289
  })
16285
16290
  }), /*#__PURE__*/jsx(Input, {
16286
16291
  inputClassName: inputClassName,
16287
- ariaLabel: ariaCurrentSuggestion.concat(' ').concat(ariaRequiredText).concat(' ').concat(SearchBarId).concat(' ').concat(ariaLabelText),
16292
+ ariaLabel: ariaCurrentSuggestion.concat(' ').concat(ariaRequiredText).concat(' ').concat(SearchBarId).concat(' ').concat(t('search-autosuggest-label', {
16293
+ lng
16294
+ })).concat(' ').concat(ariaLabelText),
16288
16295
  id: id,
16289
16296
  lng: lng,
16290
- getInputProps: getInputProps,
16297
+ getInputProps: getComboboxInputProps,
16291
16298
  getLabelProps: getLabelProps,
16292
16299
  selectItem: selectItem,
16293
16300
  value: state.value,