@atlaskit/react-select 2.0.5 → 2.0.6
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 +8 -0
- package/dist/cjs/components/live-region.js +9 -5
- package/dist/cjs/components/multi-value.js +7 -8
- package/dist/cjs/select.js +16 -5
- package/dist/es2019/components/live-region.js +6 -5
- package/dist/es2019/components/multi-value.js +7 -8
- package/dist/es2019/select.js +15 -5
- package/dist/esm/components/live-region.js +6 -5
- package/dist/esm/components/multi-value.js +7 -8
- package/dist/esm/select.js +16 -5
- package/dist/types/components/live-region.d.ts +1 -0
- package/dist/types/select.d.ts +2 -1
- package/dist/types-ts4.5/components/live-region.d.ts +1 -0
- package/dist/types-ts4.5/select.d.ts +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/react-select
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#123298](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/123298)
|
|
8
|
+
[`8a9b860d5da36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8a9b860d5da36) -
|
|
9
|
+
[ux] Improved accessibility for selected values
|
|
10
|
+
|
|
3
11
|
## 2.0.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _react2 = require("@emotion/react");
|
|
11
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _accessibility = require("../accessibility");
|
|
13
14
|
var _a11yText = _interopRequireDefault(require("./internal/a11y-text"));
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */ /**
|
|
16
19
|
* @jsxRuntime classic
|
|
17
20
|
* @jsx jsx
|
|
21
|
+
* @jsxFrag React.Fragment
|
|
18
22
|
*/
|
|
19
23
|
// ==============================
|
|
20
24
|
// Root Container
|
|
@@ -160,13 +164,13 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
160
164
|
}, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
|
|
161
165
|
var ScreenReaderText = (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("span", {
|
|
162
166
|
id: "aria-selection"
|
|
163
|
-
}, ariaSelected), (0, _react2.jsx)("span", {
|
|
167
|
+
}, ariaSelected), !(0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') && (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("span", {
|
|
168
|
+
id: "aria-results"
|
|
169
|
+
}, ariaResults), (0, _react2.jsx)("span", {
|
|
164
170
|
id: "aria-focused"
|
|
165
171
|
}, ariaFocused), (0, _react2.jsx)("span", {
|
|
166
|
-
id: "aria-results"
|
|
167
|
-
}, ariaResults), !(0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') && (0, _react2.jsx)("span", {
|
|
168
172
|
id: "aria-guidance"
|
|
169
|
-
}, ariaGuidance));
|
|
173
|
+
}, ariaGuidance)));
|
|
170
174
|
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_a11yText.default, {
|
|
171
175
|
id: id
|
|
172
176
|
}, isInitialFocus && ScreenReaderText), (0, _react2.jsx)(_a11yText.default, {
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.MultiValueLabel = exports.MultiValueContainer = void 0;
|
|
8
8
|
exports.MultiValueRemove = MultiValueRemove;
|
|
9
9
|
exports.multiValueRemoveCSS = exports.multiValueLabelCSS = exports.multiValueCSS = exports.default = void 0;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
11
|
var _react = require("@emotion/react");
|
|
13
12
|
var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-clear"));
|
|
@@ -147,7 +146,7 @@ var renderIcon = function renderIcon() {
|
|
|
147
146
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
148
147
|
if ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh')) {
|
|
149
148
|
return (0, _react.jsx)(_cross.default, {
|
|
150
|
-
label: "
|
|
149
|
+
label: "",
|
|
151
150
|
color: "currentColor"
|
|
152
151
|
});
|
|
153
152
|
}
|
|
@@ -157,14 +156,14 @@ var renderIcon = function renderIcon() {
|
|
|
157
156
|
return (0, _react.jsx)(_primitives.Inline, {
|
|
158
157
|
xcss: iconWrapperStyles
|
|
159
158
|
}, (0, _react.jsx)(_cross.default, {
|
|
160
|
-
label: "
|
|
159
|
+
label: "",
|
|
161
160
|
color: "currentColor"
|
|
162
161
|
}));
|
|
163
162
|
}
|
|
164
163
|
return (
|
|
165
164
|
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
166
165
|
(0, _react.jsx)(_selectClear.default, {
|
|
167
|
-
label: "
|
|
166
|
+
label: "",
|
|
168
167
|
primaryColor: "transparent",
|
|
169
168
|
size: "small",
|
|
170
169
|
secondaryColor: "inherit"
|
|
@@ -176,9 +175,7 @@ function MultiValueRemove(_ref5) {
|
|
|
176
175
|
innerProps = _ref5.innerProps;
|
|
177
176
|
return (
|
|
178
177
|
// The Remove button is intentionally excluded from the tab order, please avoid assigning a non-negative tabIndex to it. Context: https://hello.atlassian.net/wiki/spaces/A11YKB/pages/3031993460/Clear+Options+on+an+Input+Field
|
|
179
|
-
(0, _react.jsx)("div", (0,
|
|
180
|
-
role: "button"
|
|
181
|
-
}, innerProps), (0, _react.jsx)("div", {
|
|
178
|
+
(0, _react.jsx)("div", innerProps, (0, _react.jsx)("div", {
|
|
182
179
|
css: isDisabled ? disabledStyles : enabledStyles,
|
|
183
180
|
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
184
181
|
}, renderIcon()))
|
|
@@ -214,7 +211,9 @@ var MultiValue = function MultiValue(props) {
|
|
|
214
211
|
innerProps: _objectSpread(_objectSpread({}, (0, _utils.getStyleProps)(props, 'multiValueRemove', {
|
|
215
212
|
'multi-value__remove': true
|
|
216
213
|
})), {}, {
|
|
217
|
-
|
|
214
|
+
role: 'button',
|
|
215
|
+
tabIndex: -1,
|
|
216
|
+
'aria-label': "".concat(ariaLabel || 'option', ", remove")
|
|
218
217
|
}, removeProps),
|
|
219
218
|
isDisabled: isDisabled,
|
|
220
219
|
selectProps: selectProps
|
package/dist/cjs/select.js
CHANGED
|
@@ -239,6 +239,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
239
239
|
focusedOptionId: null,
|
|
240
240
|
focusableOptionsWithIds: [],
|
|
241
241
|
focusedValue: null,
|
|
242
|
+
focusedValueId: null,
|
|
242
243
|
inputIsHidden: false,
|
|
243
244
|
isFocused: false,
|
|
244
245
|
selectValue: [],
|
|
@@ -740,6 +741,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
740
741
|
// ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode
|
|
741
742
|
break;
|
|
742
743
|
}
|
|
744
|
+
if (focusedValue) {
|
|
745
|
+
_this.removeValue(focusedValue);
|
|
746
|
+
}
|
|
743
747
|
if (menuIsOpen) {
|
|
744
748
|
if (!focusedOption) {
|
|
745
749
|
return;
|
|
@@ -1010,7 +1014,10 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1010
1014
|
}
|
|
1011
1015
|
this.setState({
|
|
1012
1016
|
inputIsHidden: nextFocus !== -1,
|
|
1013
|
-
focusedValue: selectValue[nextFocus]
|
|
1017
|
+
focusedValue: selectValue[nextFocus],
|
|
1018
|
+
focusedValueId: "".concat(this.getElementId('selected-value'), "-").concat(nextFocus),
|
|
1019
|
+
focusedOption: null,
|
|
1020
|
+
focusedOptionId: null
|
|
1014
1021
|
});
|
|
1015
1022
|
}
|
|
1016
1023
|
}, {
|
|
@@ -1049,6 +1056,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1049
1056
|
this.setState({
|
|
1050
1057
|
focusedOption: options[nextFocus],
|
|
1051
1058
|
focusedValue: null,
|
|
1059
|
+
focusedValueId: null,
|
|
1052
1060
|
focusedOptionId: this.getFocusedOptionId(options[nextFocus])
|
|
1053
1061
|
});
|
|
1054
1062
|
}
|
|
@@ -1261,7 +1269,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1261
1269
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1262
1270
|
'aria-required': required || isRequired,
|
|
1263
1271
|
role: 'combobox',
|
|
1264
|
-
'aria-activedescendant': this.state.focusedOptionId || undefined
|
|
1272
|
+
'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined
|
|
1265
1273
|
}, menuIsOpen && {
|
|
1266
1274
|
'aria-controls': this.getElementId('listbox')
|
|
1267
1275
|
}), !isSearchable && {
|
|
@@ -1360,11 +1368,14 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1360
1368
|
},
|
|
1361
1369
|
onMouseDown: function onMouseDown(e) {
|
|
1362
1370
|
e.preventDefault();
|
|
1363
|
-
}
|
|
1371
|
+
},
|
|
1372
|
+
'data-testid': "".concat(testId, "-select--multivalue-").concat(index, "-remove")
|
|
1364
1373
|
},
|
|
1365
1374
|
data: opt,
|
|
1366
|
-
innerProps: _objectSpread({}, testId && {
|
|
1367
|
-
'data-testid': "".concat(testId, "-select--multivalue")
|
|
1375
|
+
innerProps: _objectSpread(_objectSpread({}, testId && {
|
|
1376
|
+
'data-testid': "".concat(testId, "-select--multivalue-").concat(index)
|
|
1377
|
+
}), {}, {
|
|
1378
|
+
id: "".concat(_this3.getElementId('selected-value'), "-").concat(index)
|
|
1368
1379
|
})
|
|
1369
1380
|
}), _this3.formatOptionLabel(opt, 'value'));
|
|
1370
1381
|
});
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
|
+
* @jsxFrag React.Fragment
|
|
5
6
|
*/
|
|
6
|
-
import { Fragment, useMemo, useRef } from 'react';
|
|
7
|
+
import React, { Fragment, useMemo, useRef } from 'react';
|
|
7
8
|
import { jsx } from '@emotion/react';
|
|
8
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { defaultAriaLiveMessages } from '../accessibility';
|
|
@@ -159,13 +160,13 @@ const LiveRegion = props => {
|
|
|
159
160
|
}, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
|
|
160
161
|
const ScreenReaderText = jsx(Fragment, null, jsx("span", {
|
|
161
162
|
id: "aria-selection"
|
|
162
|
-
}, ariaSelected), jsx("span", {
|
|
163
|
+
}, ariaSelected), !fg('design_system_select-a11y-improvement') && jsx(React.Fragment, null, jsx("span", {
|
|
164
|
+
id: "aria-results"
|
|
165
|
+
}, ariaResults), jsx("span", {
|
|
163
166
|
id: "aria-focused"
|
|
164
167
|
}, ariaFocused), jsx("span", {
|
|
165
|
-
id: "aria-results"
|
|
166
|
-
}, ariaResults), !fg('design_system_select-a11y-improvement') && jsx("span", {
|
|
167
168
|
id: "aria-guidance"
|
|
168
|
-
}, ariaGuidance));
|
|
169
|
+
}, ariaGuidance)));
|
|
169
170
|
return jsx(Fragment, null, jsx(A11yText, {
|
|
170
171
|
id: id
|
|
171
172
|
}, isInitialFocus && ScreenReaderText), jsx(A11yText, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
@@ -138,7 +137,7 @@ const renderIcon = () => {
|
|
|
138
137
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
139
138
|
if (fg('platform-component-visual-refresh')) {
|
|
140
139
|
return jsx(CrossIcon, {
|
|
141
|
-
label: "
|
|
140
|
+
label: "",
|
|
142
141
|
color: "currentColor"
|
|
143
142
|
});
|
|
144
143
|
}
|
|
@@ -148,14 +147,14 @@ const renderIcon = () => {
|
|
|
148
147
|
return jsx(Inline, {
|
|
149
148
|
xcss: iconWrapperStyles
|
|
150
149
|
}, jsx(CrossIcon, {
|
|
151
|
-
label: "
|
|
150
|
+
label: "",
|
|
152
151
|
color: "currentColor"
|
|
153
152
|
}));
|
|
154
153
|
}
|
|
155
154
|
return (
|
|
156
155
|
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
157
156
|
jsx(LegacySelectClearIcon, {
|
|
158
|
-
label: "
|
|
157
|
+
label: "",
|
|
159
158
|
primaryColor: "transparent",
|
|
160
159
|
size: "small",
|
|
161
160
|
secondaryColor: "inherit"
|
|
@@ -168,9 +167,7 @@ export function MultiValueRemove({
|
|
|
168
167
|
}) {
|
|
169
168
|
return (
|
|
170
169
|
// The Remove button is intentionally excluded from the tab order, please avoid assigning a non-negative tabIndex to it. Context: https://hello.atlassian.net/wiki/spaces/A11YKB/pages/3031993460/Clear+Options+on+an+Input+Field
|
|
171
|
-
jsx("div",
|
|
172
|
-
role: "button"
|
|
173
|
-
}, innerProps), jsx("div", {
|
|
170
|
+
jsx("div", innerProps, jsx("div", {
|
|
174
171
|
css: isDisabled ? disabledStyles : enabledStyles,
|
|
175
172
|
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
176
173
|
}, renderIcon()))
|
|
@@ -216,7 +213,9 @@ const MultiValue = props => {
|
|
|
216
213
|
...getStyleProps(props, 'multiValueRemove', {
|
|
217
214
|
'multi-value__remove': true
|
|
218
215
|
}),
|
|
219
|
-
|
|
216
|
+
role: 'button',
|
|
217
|
+
tabIndex: -1,
|
|
218
|
+
'aria-label': `${ariaLabel || 'option'}, remove`,
|
|
220
219
|
...removeProps
|
|
221
220
|
},
|
|
222
221
|
isDisabled: isDisabled,
|
package/dist/es2019/select.js
CHANGED
|
@@ -209,6 +209,7 @@ export default class Select extends Component {
|
|
|
209
209
|
focusedOptionId: null,
|
|
210
210
|
focusableOptionsWithIds: [],
|
|
211
211
|
focusedValue: null,
|
|
212
|
+
focusedValueId: null,
|
|
212
213
|
inputIsHidden: false,
|
|
213
214
|
isFocused: false,
|
|
214
215
|
selectValue: [],
|
|
@@ -716,6 +717,9 @@ export default class Select extends Component {
|
|
|
716
717
|
// ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode
|
|
717
718
|
break;
|
|
718
719
|
}
|
|
720
|
+
if (focusedValue) {
|
|
721
|
+
this.removeValue(focusedValue);
|
|
722
|
+
}
|
|
719
723
|
if (menuIsOpen) {
|
|
720
724
|
if (!focusedOption) {
|
|
721
725
|
return;
|
|
@@ -1033,7 +1037,10 @@ export default class Select extends Component {
|
|
|
1033
1037
|
}
|
|
1034
1038
|
this.setState({
|
|
1035
1039
|
inputIsHidden: nextFocus !== -1,
|
|
1036
|
-
focusedValue: selectValue[nextFocus]
|
|
1040
|
+
focusedValue: selectValue[nextFocus],
|
|
1041
|
+
focusedValueId: `${this.getElementId('selected-value')}-${nextFocus}`,
|
|
1042
|
+
focusedOption: null,
|
|
1043
|
+
focusedOptionId: null
|
|
1037
1044
|
});
|
|
1038
1045
|
}
|
|
1039
1046
|
focusOption(direction = 'first') {
|
|
@@ -1073,6 +1080,7 @@ export default class Select extends Component {
|
|
|
1073
1080
|
this.setState({
|
|
1074
1081
|
focusedOption: options[nextFocus],
|
|
1075
1082
|
focusedValue: null,
|
|
1083
|
+
focusedValueId: null,
|
|
1076
1084
|
focusedOptionId: this.getFocusedOptionId(options[nextFocus])
|
|
1077
1085
|
});
|
|
1078
1086
|
}
|
|
@@ -1271,7 +1279,7 @@ export default class Select extends Component {
|
|
|
1271
1279
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1272
1280
|
'aria-required': required || isRequired,
|
|
1273
1281
|
role: 'combobox',
|
|
1274
|
-
'aria-activedescendant': this.state.focusedOptionId || undefined,
|
|
1282
|
+
'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined,
|
|
1275
1283
|
...(menuIsOpen && {
|
|
1276
1284
|
'aria-controls': this.getElementId('listbox')
|
|
1277
1285
|
}),
|
|
@@ -1373,13 +1381,15 @@ export default class Select extends Component {
|
|
|
1373
1381
|
onTouchEnd: () => this.removeValue(opt),
|
|
1374
1382
|
onMouseDown: e => {
|
|
1375
1383
|
e.preventDefault();
|
|
1376
|
-
}
|
|
1384
|
+
},
|
|
1385
|
+
'data-testid': `${testId}-select--multivalue-${index}-remove`
|
|
1377
1386
|
},
|
|
1378
1387
|
data: opt,
|
|
1379
1388
|
innerProps: {
|
|
1380
1389
|
...(testId && {
|
|
1381
|
-
'data-testid': `${testId}-select--multivalue`
|
|
1382
|
-
})
|
|
1390
|
+
'data-testid': `${testId}-select--multivalue-${index}`
|
|
1391
|
+
}),
|
|
1392
|
+
id: `${this.getElementId('selected-value')}-${index}`
|
|
1383
1393
|
}
|
|
1384
1394
|
}), this.formatOptionLabel(opt, 'value'));
|
|
1385
1395
|
});
|
|
@@ -5,8 +5,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
/**
|
|
6
6
|
* @jsxRuntime classic
|
|
7
7
|
* @jsx jsx
|
|
8
|
+
* @jsxFrag React.Fragment
|
|
8
9
|
*/
|
|
9
|
-
import { Fragment, useMemo, useRef } from 'react';
|
|
10
|
+
import React, { Fragment, useMemo, useRef } from 'react';
|
|
10
11
|
import { jsx } from '@emotion/react';
|
|
11
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { defaultAriaLiveMessages } from '../accessibility';
|
|
@@ -156,13 +157,13 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
156
157
|
}, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
|
|
157
158
|
var ScreenReaderText = jsx(Fragment, null, jsx("span", {
|
|
158
159
|
id: "aria-selection"
|
|
159
|
-
}, ariaSelected), jsx("span", {
|
|
160
|
+
}, ariaSelected), !fg('design_system_select-a11y-improvement') && jsx(React.Fragment, null, jsx("span", {
|
|
161
|
+
id: "aria-results"
|
|
162
|
+
}, ariaResults), jsx("span", {
|
|
160
163
|
id: "aria-focused"
|
|
161
164
|
}, ariaFocused), jsx("span", {
|
|
162
|
-
id: "aria-results"
|
|
163
|
-
}, ariaResults), !fg('design_system_select-a11y-improvement') && jsx("span", {
|
|
164
165
|
id: "aria-guidance"
|
|
165
|
-
}, ariaGuidance));
|
|
166
|
+
}, ariaGuidance)));
|
|
166
167
|
return jsx(Fragment, null, jsx(A11yText, {
|
|
167
168
|
id: id
|
|
168
169
|
}, isInitialFocus && ScreenReaderText), jsx(A11yText, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -140,7 +139,7 @@ var renderIcon = function renderIcon() {
|
|
|
140
139
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
141
140
|
if (fg('platform-component-visual-refresh')) {
|
|
142
141
|
return jsx(CrossIcon, {
|
|
143
|
-
label: "
|
|
142
|
+
label: "",
|
|
144
143
|
color: "currentColor"
|
|
145
144
|
});
|
|
146
145
|
}
|
|
@@ -150,14 +149,14 @@ var renderIcon = function renderIcon() {
|
|
|
150
149
|
return jsx(Inline, {
|
|
151
150
|
xcss: iconWrapperStyles
|
|
152
151
|
}, jsx(CrossIcon, {
|
|
153
|
-
label: "
|
|
152
|
+
label: "",
|
|
154
153
|
color: "currentColor"
|
|
155
154
|
}));
|
|
156
155
|
}
|
|
157
156
|
return (
|
|
158
157
|
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
159
158
|
jsx(LegacySelectClearIcon, {
|
|
160
|
-
label: "
|
|
159
|
+
label: "",
|
|
161
160
|
primaryColor: "transparent",
|
|
162
161
|
size: "small",
|
|
163
162
|
secondaryColor: "inherit"
|
|
@@ -169,9 +168,7 @@ export function MultiValueRemove(_ref5) {
|
|
|
169
168
|
innerProps = _ref5.innerProps;
|
|
170
169
|
return (
|
|
171
170
|
// The Remove button is intentionally excluded from the tab order, please avoid assigning a non-negative tabIndex to it. Context: https://hello.atlassian.net/wiki/spaces/A11YKB/pages/3031993460/Clear+Options+on+an+Input+Field
|
|
172
|
-
jsx("div",
|
|
173
|
-
role: "button"
|
|
174
|
-
}, innerProps), jsx("div", {
|
|
171
|
+
jsx("div", innerProps, jsx("div", {
|
|
175
172
|
css: isDisabled ? disabledStyles : enabledStyles,
|
|
176
173
|
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
177
174
|
}, renderIcon()))
|
|
@@ -207,7 +204,9 @@ var MultiValue = function MultiValue(props) {
|
|
|
207
204
|
innerProps: _objectSpread(_objectSpread({}, getStyleProps(props, 'multiValueRemove', {
|
|
208
205
|
'multi-value__remove': true
|
|
209
206
|
})), {}, {
|
|
210
|
-
|
|
207
|
+
role: 'button',
|
|
208
|
+
tabIndex: -1,
|
|
209
|
+
'aria-label': "".concat(ariaLabel || 'option', ", remove")
|
|
211
210
|
}, removeProps),
|
|
212
211
|
isDisabled: isDisabled,
|
|
213
212
|
selectProps: selectProps
|
package/dist/esm/select.js
CHANGED
|
@@ -230,6 +230,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
230
230
|
focusedOptionId: null,
|
|
231
231
|
focusableOptionsWithIds: [],
|
|
232
232
|
focusedValue: null,
|
|
233
|
+
focusedValueId: null,
|
|
233
234
|
inputIsHidden: false,
|
|
234
235
|
isFocused: false,
|
|
235
236
|
selectValue: [],
|
|
@@ -731,6 +732,9 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
731
732
|
// ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode
|
|
732
733
|
break;
|
|
733
734
|
}
|
|
735
|
+
if (focusedValue) {
|
|
736
|
+
_this.removeValue(focusedValue);
|
|
737
|
+
}
|
|
734
738
|
if (menuIsOpen) {
|
|
735
739
|
if (!focusedOption) {
|
|
736
740
|
return;
|
|
@@ -1001,7 +1005,10 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1001
1005
|
}
|
|
1002
1006
|
this.setState({
|
|
1003
1007
|
inputIsHidden: nextFocus !== -1,
|
|
1004
|
-
focusedValue: selectValue[nextFocus]
|
|
1008
|
+
focusedValue: selectValue[nextFocus],
|
|
1009
|
+
focusedValueId: "".concat(this.getElementId('selected-value'), "-").concat(nextFocus),
|
|
1010
|
+
focusedOption: null,
|
|
1011
|
+
focusedOptionId: null
|
|
1005
1012
|
});
|
|
1006
1013
|
}
|
|
1007
1014
|
}, {
|
|
@@ -1040,6 +1047,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1040
1047
|
this.setState({
|
|
1041
1048
|
focusedOption: options[nextFocus],
|
|
1042
1049
|
focusedValue: null,
|
|
1050
|
+
focusedValueId: null,
|
|
1043
1051
|
focusedOptionId: this.getFocusedOptionId(options[nextFocus])
|
|
1044
1052
|
});
|
|
1045
1053
|
}
|
|
@@ -1252,7 +1260,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1252
1260
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1253
1261
|
'aria-required': required || isRequired,
|
|
1254
1262
|
role: 'combobox',
|
|
1255
|
-
'aria-activedescendant': this.state.focusedOptionId || undefined
|
|
1263
|
+
'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined
|
|
1256
1264
|
}, menuIsOpen && {
|
|
1257
1265
|
'aria-controls': this.getElementId('listbox')
|
|
1258
1266
|
}), !isSearchable && {
|
|
@@ -1351,11 +1359,14 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1351
1359
|
},
|
|
1352
1360
|
onMouseDown: function onMouseDown(e) {
|
|
1353
1361
|
e.preventDefault();
|
|
1354
|
-
}
|
|
1362
|
+
},
|
|
1363
|
+
'data-testid': "".concat(testId, "-select--multivalue-").concat(index, "-remove")
|
|
1355
1364
|
},
|
|
1356
1365
|
data: opt,
|
|
1357
|
-
innerProps: _objectSpread({}, testId && {
|
|
1358
|
-
'data-testid': "".concat(testId, "-select--multivalue")
|
|
1366
|
+
innerProps: _objectSpread(_objectSpread({}, testId && {
|
|
1367
|
+
'data-testid': "".concat(testId, "-select--multivalue-").concat(index)
|
|
1368
|
+
}), {}, {
|
|
1369
|
+
id: "".concat(_this3.getElementId('selected-value'), "-").concat(index)
|
|
1359
1370
|
})
|
|
1360
1371
|
}), _this3.formatOptionLabel(opt, 'value'));
|
|
1361
1372
|
});
|
package/dist/types/select.d.ts
CHANGED
|
@@ -475,6 +475,7 @@ interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>
|
|
|
475
475
|
focusedOptionId: string | null;
|
|
476
476
|
focusableOptionsWithIds: FocusableOptionWithId<Option>[];
|
|
477
477
|
focusedValue: Option | null;
|
|
478
|
+
focusedValueId: string | null;
|
|
478
479
|
selectValue: Options<Option>;
|
|
479
480
|
clearFocusValueOnUpdate: boolean;
|
|
480
481
|
prevWasFocused: boolean;
|
|
@@ -618,7 +619,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
618
619
|
getOptionValue: (data: Option) => string;
|
|
619
620
|
getStyles: <Key extends keyof StylesProps<Option, IsMulti, Group>>(key: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => import("./types").CSSObjectWithLabel;
|
|
620
621
|
getClassNames: <Key extends keyof StylesProps<Option, IsMulti, Group>>(key: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => string | undefined;
|
|
621
|
-
getElementId: (element: 'group' | 'input' | 'listbox' | 'option' | 'placeholder' | 'live-region' | 'multi-message') => string;
|
|
622
|
+
getElementId: (element: 'group' | 'input' | 'listbox' | 'option' | 'placeholder' | 'live-region' | 'multi-message' | 'selected-value') => string;
|
|
622
623
|
getComponents: () => {
|
|
623
624
|
ClearIndicator: <Option_1, IsMulti_1 extends boolean, Group_1 extends GroupBase<Option_1>>(props: import(".").ClearIndicatorProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
624
625
|
Control: <Option_2, IsMulti_2 extends boolean, Group_2 extends GroupBase<Option_2>>(props: import(".").ControlProps<Option_2, IsMulti_2, Group_2>) => import("@emotion/react").jsx.JSX.Element;
|
|
@@ -475,6 +475,7 @@ interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>
|
|
|
475
475
|
focusedOptionId: string | null;
|
|
476
476
|
focusableOptionsWithIds: FocusableOptionWithId<Option>[];
|
|
477
477
|
focusedValue: Option | null;
|
|
478
|
+
focusedValueId: string | null;
|
|
478
479
|
selectValue: Options<Option>;
|
|
479
480
|
clearFocusValueOnUpdate: boolean;
|
|
480
481
|
prevWasFocused: boolean;
|
|
@@ -618,7 +619,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
618
619
|
getOptionValue: (data: Option) => string;
|
|
619
620
|
getStyles: <Key extends keyof StylesProps<Option, IsMulti, Group>>(key: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => import("./types").CSSObjectWithLabel;
|
|
620
621
|
getClassNames: <Key extends keyof StylesProps<Option, IsMulti, Group>>(key: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => string | undefined;
|
|
621
|
-
getElementId: (element: 'group' | 'input' | 'listbox' | 'option' | 'placeholder' | 'live-region' | 'multi-message') => string;
|
|
622
|
+
getElementId: (element: 'group' | 'input' | 'listbox' | 'option' | 'placeholder' | 'live-region' | 'multi-message' | 'selected-value') => string;
|
|
622
623
|
getComponents: () => {
|
|
623
624
|
ClearIndicator: <Option_1, IsMulti_1 extends boolean, Group_1 extends GroupBase<Option_1>>(props: import(".").ClearIndicatorProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
624
625
|
Control: <Option_2, IsMulti_2 extends boolean, Group_2 extends GroupBase<Option_2>>(props: import(".").ControlProps<Option_2, IsMulti_2, Group_2>) => import("@emotion/react").jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-select",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
35
35
|
"@atlaskit/primitives": "^14.1.0",
|
|
36
36
|
"@atlaskit/spinner": "^18.0.0",
|
|
37
|
-
"@atlaskit/tokens": "^4.
|
|
37
|
+
"@atlaskit/tokens": "^4.5.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
39
|
"@emotion/react": "^11.7.1",
|
|
40
40
|
"@floating-ui/dom": "^1.0.1",
|