@rc-component/select 1.6.9 → 1.6.11
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/es/BaseSelect/index.js +3 -1
- package/es/OptionList.js +5 -2
- package/lib/BaseSelect/index.js +3 -1
- package/lib/OptionList.js +5 -2
- package/package.json +1 -1
package/es/BaseSelect/index.js
CHANGED
|
@@ -230,7 +230,9 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
230
230
|
// Enter or Space opens dropdown (ARIA combobox: spacebar should open)
|
|
231
231
|
if (isEnterKey || isSpaceKey) {
|
|
232
232
|
// Do not submit form when type in the input; prevent Space from scrolling page
|
|
233
|
-
|
|
233
|
+
const isCombobox = mode === 'combobox';
|
|
234
|
+
const isEditable = isCombobox || showSearch;
|
|
235
|
+
if (isSpaceKey && !isEditable || isEnterKey && !isCombobox) {
|
|
234
236
|
event.preventDefault();
|
|
235
237
|
}
|
|
236
238
|
|
package/es/OptionList.js
CHANGED
|
@@ -261,7 +261,8 @@ const OptionList = (_, ref) => {
|
|
|
261
261
|
}
|
|
262
262
|
const itemData = item.data || {};
|
|
263
263
|
const {
|
|
264
|
-
value
|
|
264
|
+
value,
|
|
265
|
+
disabled
|
|
265
266
|
} = itemData;
|
|
266
267
|
const {
|
|
267
268
|
group
|
|
@@ -273,7 +274,8 @@ const OptionList = (_, ref) => {
|
|
|
273
274
|
}, attrs, {
|
|
274
275
|
key: index
|
|
275
276
|
}, getItemAriaProps(item, index), {
|
|
276
|
-
"aria-selected": isAriaSelected(value)
|
|
277
|
+
"aria-selected": isAriaSelected(value),
|
|
278
|
+
"aria-disabled": disabled
|
|
277
279
|
}), value) : null;
|
|
278
280
|
};
|
|
279
281
|
const a11yProps = {
|
|
@@ -353,6 +355,7 @@ const OptionList = (_, ref) => {
|
|
|
353
355
|
}
|
|
354
356
|
return /*#__PURE__*/React.createElement("div", _extends({}, pickAttrs(passedProps), !virtual ? getItemAriaProps(item, itemIndex) : {}, {
|
|
355
357
|
"aria-selected": virtual ? undefined : isAriaSelected(value),
|
|
358
|
+
"aria-disabled": mergedDisabled,
|
|
356
359
|
className: optionClassName,
|
|
357
360
|
title: optionTitle,
|
|
358
361
|
onMouseMove: () => {
|
package/lib/BaseSelect/index.js
CHANGED
|
@@ -239,7 +239,9 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
239
239
|
// Enter or Space opens dropdown (ARIA combobox: spacebar should open)
|
|
240
240
|
if (isEnterKey || isSpaceKey) {
|
|
241
241
|
// Do not submit form when type in the input; prevent Space from scrolling page
|
|
242
|
-
|
|
242
|
+
const isCombobox = mode === 'combobox';
|
|
243
|
+
const isEditable = isCombobox || showSearch;
|
|
244
|
+
if (isSpaceKey && !isEditable || isEnterKey && !isCombobox) {
|
|
243
245
|
event.preventDefault();
|
|
244
246
|
}
|
|
245
247
|
|
package/lib/OptionList.js
CHANGED
|
@@ -269,7 +269,8 @@ const OptionList = (_, ref) => {
|
|
|
269
269
|
}
|
|
270
270
|
const itemData = item.data || {};
|
|
271
271
|
const {
|
|
272
|
-
value
|
|
272
|
+
value,
|
|
273
|
+
disabled
|
|
273
274
|
} = itemData;
|
|
274
275
|
const {
|
|
275
276
|
group
|
|
@@ -281,7 +282,8 @@ const OptionList = (_, ref) => {
|
|
|
281
282
|
}, attrs, {
|
|
282
283
|
key: index
|
|
283
284
|
}, getItemAriaProps(item, index), {
|
|
284
|
-
"aria-selected": isAriaSelected(value)
|
|
285
|
+
"aria-selected": isAriaSelected(value),
|
|
286
|
+
"aria-disabled": disabled
|
|
285
287
|
}), value) : null;
|
|
286
288
|
};
|
|
287
289
|
const a11yProps = {
|
|
@@ -361,6 +363,7 @@ const OptionList = (_, ref) => {
|
|
|
361
363
|
}
|
|
362
364
|
return /*#__PURE__*/React.createElement("div", _extends({}, (0, _pickAttrs.default)(passedProps), !virtual ? getItemAriaProps(item, itemIndex) : {}, {
|
|
363
365
|
"aria-selected": virtual ? undefined : isAriaSelected(value),
|
|
366
|
+
"aria-disabled": mergedDisabled,
|
|
364
367
|
className: optionClassName,
|
|
365
368
|
title: optionTitle,
|
|
366
369
|
onMouseMove: () => {
|