baseui 0.0.0-next-1598215 → 0.0.0-next-716b34f

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.
@@ -60,6 +60,7 @@ function Combobox(props) {
60
60
  onChange = props.onChange,
61
61
  onFocus = props.onFocus,
62
62
  onSubmit = props.onSubmit,
63
+ listBoxLabel = props.listBoxLabel,
63
64
  mapOptionToNode = props.mapOptionToNode,
64
65
  mapOptionToString = props.mapOptionToString,
65
66
  id = props.id,
@@ -322,6 +323,7 @@ function Combobox(props) {
322
323
  ,
323
324
  ref: listboxRef,
324
325
  role: "listbox",
326
+ "aria-label": listBoxLabel,
325
327
  $width: listboxWidth
326
328
  }, listBoxProps), options.map(function (option, index) {
327
329
  var isSelected = selectionIndex === index;
@@ -360,9 +362,8 @@ function Combobox(props) {
360
362
  role: "combobox"
361
363
  }, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
362
364
  inputRef: handleInputRef,
363
- "aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
365
+ "aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
364
366
  "aria-autocomplete": "list",
365
- "aria-controls": listboxId,
366
367
  disabled: disabled,
367
368
  error: error,
368
369
  name: name,
@@ -375,7 +376,9 @@ function Combobox(props) {
375
376
  positive: positive,
376
377
  size: size,
377
378
  value: tempValue ? tempValue : value
378
- }, restInputProps)))));
379
+ }, isOpen ? {
380
+ 'aria-controls': listboxId
381
+ } : {}, restInputProps)))));
379
382
  }
380
383
 
381
384
  var _default = Combobox;
@@ -38,6 +38,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
38
38
  onChange,
39
39
  onFocus,
40
40
  onSubmit,
41
+ listBoxLabel,
41
42
  mapOptionToNode,
42
43
  mapOptionToString,
43
44
  id,
@@ -274,6 +275,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
274
275
  // eslint-disable-next-line flowtype/no-weak-types
275
276
  ref={(listboxRef: any)}
276
277
  role="listbox"
278
+ aria-label={listBoxLabel}
277
279
  $width={listboxWidth}
278
280
  {...listBoxProps}
279
281
  >
@@ -322,10 +324,9 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
322
324
  <OverriddenInput
323
325
  inputRef={handleInputRef}
324
326
  aria-activedescendant={
325
- selectionIndex >= 0 ? activeDescendantId : undefined
327
+ isOpen && selectionIndex >= 0 ? activeDescendantId : undefined
326
328
  }
327
329
  aria-autocomplete="list"
328
- aria-controls={listboxId}
329
330
  disabled={disabled}
330
331
  error={error}
331
332
  name={name}
@@ -338,6 +339,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
338
339
  positive={positive}
339
340
  size={size}
340
341
  value={tempValue ? tempValue : value}
342
+ {...(isOpen ? {'aria-controls': listboxId} : {})}
341
343
  {...restInputProps}
342
344
  />
343
345
  </InputContainer>
@@ -18,6 +18,8 @@ export type PropsT<OptionT = mixed> = {|
18
18
  disabled?: boolean,
19
19
  // Proxies value through to Input component.
20
20
  error?: boolean,
21
+ // Label used for the listbox/popup with options
22
+ listBoxLabel?: string,
21
23
  // Used to render a custom node besides the default.
22
24
  mapOptionToNode?: React.AbstractComponent<{|
23
25
  isSelected: boolean,
@@ -28,6 +28,7 @@ function Combobox(props) {
28
28
  onChange,
29
29
  onFocus,
30
30
  onSubmit,
31
+ listBoxLabel,
31
32
  mapOptionToNode,
32
33
  mapOptionToString,
33
34
  id,
@@ -251,6 +252,7 @@ function Combobox(props) {
251
252
  ,
252
253
  ref: listboxRef,
253
254
  role: "listbox",
255
+ "aria-label": listBoxLabel,
254
256
  $width: listboxWidth
255
257
  }, listBoxProps), options.map((option, index) => {
256
258
  const isSelected = selectionIndex === index;
@@ -287,9 +289,8 @@ function Combobox(props) {
287
289
  role: "combobox"
288
290
  }, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
289
291
  inputRef: handleInputRef,
290
- "aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
292
+ "aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
291
293
  "aria-autocomplete": "list",
292
- "aria-controls": listboxId,
293
294
  disabled: disabled,
294
295
  error: error,
295
296
  name: name,
@@ -302,7 +303,9 @@ function Combobox(props) {
302
303
  positive: positive,
303
304
  size: size,
304
305
  value: tempValue ? tempValue : value
305
- }, restInputProps)))));
306
+ }, isOpen ? {
307
+ 'aria-controls': listboxId
308
+ } : {}, restInputProps)))));
306
309
  }
307
310
 
308
311
  export default Combobox;
@@ -46,6 +46,7 @@ function Combobox(props) {
46
46
  onChange = props.onChange,
47
47
  onFocus = props.onFocus,
48
48
  onSubmit = props.onSubmit,
49
+ listBoxLabel = props.listBoxLabel,
49
50
  mapOptionToNode = props.mapOptionToNode,
50
51
  mapOptionToString = props.mapOptionToString,
51
52
  id = props.id,
@@ -308,6 +309,7 @@ function Combobox(props) {
308
309
  ,
309
310
  ref: listboxRef,
310
311
  role: "listbox",
312
+ "aria-label": listBoxLabel,
311
313
  $width: listboxWidth
312
314
  }, listBoxProps), options.map(function (option, index) {
313
315
  var isSelected = selectionIndex === index;
@@ -346,9 +348,8 @@ function Combobox(props) {
346
348
  role: "combobox"
347
349
  }, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
348
350
  inputRef: handleInputRef,
349
- "aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
351
+ "aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
350
352
  "aria-autocomplete": "list",
351
- "aria-controls": listboxId,
352
353
  disabled: disabled,
353
354
  error: error,
354
355
  name: name,
@@ -361,7 +362,9 @@ function Combobox(props) {
361
362
  positive: positive,
362
363
  size: size,
363
364
  value: tempValue ? tempValue : value
364
- }, restInputProps)))));
365
+ }, isOpen ? {
366
+ 'aria-controls': listboxId
367
+ } : {}, restInputProps)))));
365
368
  }
366
369
 
367
370
  export default Combobox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-1598215",
3
+ "version": "0.0.0-next-716b34f",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",