@atlaskit/react-select 2.0.1 → 2.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 2.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#119038](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/119038)
8
+ [`5c68906e5ab22`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c68906e5ab22) -
9
+ [ux] Update accessible description for when multiple selections are available
10
+
3
11
  ## 2.0.1
4
12
 
5
13
  ### Patch Changes
@@ -1149,13 +1149,13 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1149
1149
  var isMulti = this.props.isMulti;
1150
1150
  var selectValue = this.state.selectValue;
1151
1151
  var defaultDescription = selectValue.length ? this.getElementId('live-region') : this.getElementId('placeholder');
1152
- if (selectValue.length && action !== 'initial-input-focus') {
1152
+ if (!isMulti && selectValue.length && action !== 'initial-input-focus') {
1153
1153
  return;
1154
1154
  }
1155
- if (isMulti && (0, _deviceCheck.isAppleDevice)() && !(0, _deviceCheck.isSafari)()) {
1156
- // chrome only friends
1155
+ if (isMulti) {
1156
+ var multiMessage = this.getElementId('multi-message');
1157
1157
  return {
1158
- 'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, this.getElementId('multi-message')].join(' ') : [defaultDescription, this.getElementId('multi-message')].join(' ')
1158
+ 'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, multiMessage].join(' ') : [defaultDescription, multiMessage].join(' ')
1159
1159
  };
1160
1160
  } else {
1161
1161
  return {
@@ -1639,7 +1639,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1639
1639
  'data-testid': "".concat(testId, "-select--listbox")
1640
1640
  }), (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') && {
1641
1641
  'aria-label': label,
1642
- 'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input'), " ").concat(commonProps.isMulti && (0, _deviceCheck.isSafari)() ? _this4.getElementId('multi-message') : '')
1642
+ 'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input'))
1643
1643
  }),
1644
1644
  isLoading: isLoading,
1645
1645
  maxHeight: maxHeight,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
4
4
  import React, { Component } from 'react';
5
- import { isAppleDevice, isSafari } from '@atlaskit/ds-lib/device-check';
5
+ import { isAppleDevice } from '@atlaskit/ds-lib/device-check';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
7
  import { formatGroupLabel as formatGroupLabelBuiltin, getOptionLabel as getOptionLabelBuiltin, getOptionValue as getOptionValueBuiltin, isOptionDisabled as isOptionDisabledBuiltin } from './builtins';
8
8
  import { defaultComponents } from './components';
@@ -1168,13 +1168,13 @@ export default class Select extends Component {
1168
1168
  selectValue
1169
1169
  } = this.state;
1170
1170
  const defaultDescription = selectValue.length ? this.getElementId('live-region') : this.getElementId('placeholder');
1171
- if (selectValue.length && action !== 'initial-input-focus') {
1171
+ if (!isMulti && selectValue.length && action !== 'initial-input-focus') {
1172
1172
  return;
1173
1173
  }
1174
- if (isMulti && isAppleDevice() && !isSafari()) {
1175
- // chrome only friends
1174
+ if (isMulti) {
1175
+ const multiMessage = this.getElementId('multi-message');
1176
1176
  return {
1177
- 'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, this.getElementId('multi-message')].join(' ') : [defaultDescription, this.getElementId('multi-message')].join(' ')
1177
+ 'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, multiMessage].join(' ') : [defaultDescription, multiMessage].join(' ')
1178
1178
  };
1179
1179
  } else {
1180
1180
  return {
@@ -1677,7 +1677,7 @@ export default class Select extends Component {
1677
1677
  // add aditional label on listbox when ff is on
1678
1678
  ...(fg('design_system_select-a11y-improvement') && {
1679
1679
  'aria-label': label,
1680
- 'aria-labelledby': `${labelId || ((_this$inputRef = this.inputRef) === null || _this$inputRef === void 0 ? void 0 : _this$inputRef.id) || this.getElementId('input')} ${commonProps.isMulti && isSafari() ? this.getElementId('multi-message') : ''}`
1680
+ 'aria-labelledby': `${labelId || ((_this$inputRef = this.inputRef) === null || _this$inputRef === void 0 ? void 0 : _this$inputRef.id) || this.getElementId('input')}`
1681
1681
  })
1682
1682
  },
1683
1683
  isLoading: isLoading,
@@ -13,7 +13,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
13
13
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
14
  /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
15
15
  import React, { Component } from 'react';
16
- import { isAppleDevice, isSafari } from '@atlaskit/ds-lib/device-check';
16
+ import { isAppleDevice } from '@atlaskit/ds-lib/device-check';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
18
  import { formatGroupLabel as formatGroupLabelBuiltin, getOptionLabel as getOptionLabelBuiltin, getOptionValue as getOptionValueBuiltin, isOptionDisabled as isOptionDisabledBuiltin } from './builtins';
19
19
  import { defaultComponents } from './components';
@@ -1140,13 +1140,13 @@ var Select = /*#__PURE__*/function (_Component) {
1140
1140
  var isMulti = this.props.isMulti;
1141
1141
  var selectValue = this.state.selectValue;
1142
1142
  var defaultDescription = selectValue.length ? this.getElementId('live-region') : this.getElementId('placeholder');
1143
- if (selectValue.length && action !== 'initial-input-focus') {
1143
+ if (!isMulti && selectValue.length && action !== 'initial-input-focus') {
1144
1144
  return;
1145
1145
  }
1146
- if (isMulti && isAppleDevice() && !isSafari()) {
1147
- // chrome only friends
1146
+ if (isMulti) {
1147
+ var multiMessage = this.getElementId('multi-message');
1148
1148
  return {
1149
- 'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, this.getElementId('multi-message')].join(' ') : [defaultDescription, this.getElementId('multi-message')].join(' ')
1149
+ 'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, multiMessage].join(' ') : [defaultDescription, multiMessage].join(' ')
1150
1150
  };
1151
1151
  } else {
1152
1152
  return {
@@ -1630,7 +1630,7 @@ var Select = /*#__PURE__*/function (_Component) {
1630
1630
  'data-testid': "".concat(testId, "-select--listbox")
1631
1631
  }), fg('design_system_select-a11y-improvement') && {
1632
1632
  'aria-label': label,
1633
- 'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input'), " ").concat(commonProps.isMulti && isSafari() ? _this4.getElementId('multi-message') : '')
1633
+ 'aria-labelledby': "".concat(labelId || ((_this4$inputRef = _this4.inputRef) === null || _this4$inputRef === void 0 ? void 0 : _this4$inputRef.id) || _this4.getElementId('input'))
1634
1634
  }),
1635
1635
  isLoading: isLoading,
1636
1636
  maxHeight: maxHeight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "A forked version of react-select to only be used in atlaskit/select",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",