@transferwise/components 0.0.0-experimental-44982e0 → 0.0.0-experimental-f13f3a7
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/build/index.esm.js +3 -3
- package/build/index.js +3 -3
- package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts +1 -1
- package/package.json +1 -1
- package/src/typeahead/Typeahead.spec.js +9 -0
- package/src/typeahead/Typeahead.tsx +1 -1
- package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +3 -3
package/build/index.esm.js
CHANGED
|
@@ -11939,7 +11939,7 @@ class TypeaheadInput extends Component {
|
|
|
11939
11939
|
autoFocus,
|
|
11940
11940
|
multiple,
|
|
11941
11941
|
name,
|
|
11942
|
-
|
|
11942
|
+
dropdownOpen,
|
|
11943
11943
|
placeholder,
|
|
11944
11944
|
selected,
|
|
11945
11945
|
value,
|
|
@@ -11961,7 +11961,7 @@ class TypeaheadInput extends Component {
|
|
|
11961
11961
|
autoFocus: autoFocus,
|
|
11962
11962
|
placeholder: hasPlaceholder ? placeholder : '',
|
|
11963
11963
|
"aria-autocomplete": "list",
|
|
11964
|
-
"aria-expanded":
|
|
11964
|
+
"aria-expanded": dropdownOpen,
|
|
11965
11965
|
"aria-haspopup": "listbox",
|
|
11966
11966
|
"aria-controls": `menu-${typeaheadId}`,
|
|
11967
11967
|
autoComplete: autoComplete,
|
|
@@ -12463,7 +12463,7 @@ class Typeahead extends Component {
|
|
|
12463
12463
|
}), /*#__PURE__*/jsx(TypeaheadInput, {
|
|
12464
12464
|
autoFocus,
|
|
12465
12465
|
multiple,
|
|
12466
|
-
|
|
12466
|
+
dropdownOpen,
|
|
12467
12467
|
placeholder,
|
|
12468
12468
|
selected,
|
|
12469
12469
|
maxHeight,
|
package/build/index.js
CHANGED
|
@@ -11972,7 +11972,7 @@ class TypeaheadInput extends React.Component {
|
|
|
11972
11972
|
autoFocus,
|
|
11973
11973
|
multiple,
|
|
11974
11974
|
name,
|
|
11975
|
-
|
|
11975
|
+
dropdownOpen,
|
|
11976
11976
|
placeholder,
|
|
11977
11977
|
selected,
|
|
11978
11978
|
value,
|
|
@@ -11994,7 +11994,7 @@ class TypeaheadInput extends React.Component {
|
|
|
11994
11994
|
autoFocus: autoFocus,
|
|
11995
11995
|
placeholder: hasPlaceholder ? placeholder : '',
|
|
11996
11996
|
"aria-autocomplete": "list",
|
|
11997
|
-
"aria-expanded":
|
|
11997
|
+
"aria-expanded": dropdownOpen,
|
|
11998
11998
|
"aria-haspopup": "listbox",
|
|
11999
11999
|
"aria-controls": `menu-${typeaheadId}`,
|
|
12000
12000
|
autoComplete: autoComplete,
|
|
@@ -12496,7 +12496,7 @@ class Typeahead extends React.Component {
|
|
|
12496
12496
|
}), /*#__PURE__*/jsxRuntime.jsx(TypeaheadInput, {
|
|
12497
12497
|
autoFocus,
|
|
12498
12498
|
multiple,
|
|
12499
|
-
|
|
12499
|
+
dropdownOpen,
|
|
12500
12500
|
placeholder,
|
|
12501
12501
|
selected,
|
|
12502
12502
|
maxHeight,
|
|
@@ -4,7 +4,7 @@ export type TypeaheadInputProps<T> = {
|
|
|
4
4
|
typeaheadId: string;
|
|
5
5
|
value: string;
|
|
6
6
|
selected: readonly TypeaheadOption<T>[];
|
|
7
|
-
|
|
7
|
+
dropdownOpen?: boolean;
|
|
8
8
|
autoComplete: string;
|
|
9
9
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
10
10
|
onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;
|
package/package.json
CHANGED
|
@@ -370,5 +370,14 @@ describe('Typeahead', () => {
|
|
|
370
370
|
input().simulate('change', { target: { value: 'test' } });
|
|
371
371
|
expect(menu().is('.open')).toBe(true);
|
|
372
372
|
});
|
|
373
|
+
|
|
374
|
+
it('sets aria-expanded to true when options are shown', () => {
|
|
375
|
+
expect(input().prop('aria-expanded')).toBe(false);
|
|
376
|
+
// we don't want aria-expanded to be true on focus or before 3 characters are entered (that's when the menu is shown)
|
|
377
|
+
input().simulate('change', { target: { value: 'aa' } });
|
|
378
|
+
expect(input().prop('aria-expanded')).toBe(false);
|
|
379
|
+
input().simulate('change', { target: { value: 'aaa' } });
|
|
380
|
+
expect(input().prop('aria-expanded')).toBe(true);
|
|
381
|
+
});
|
|
373
382
|
});
|
|
374
383
|
});
|
|
@@ -13,7 +13,7 @@ export type TypeaheadInputProps<T> = {
|
|
|
13
13
|
typeaheadId: string;
|
|
14
14
|
value: string;
|
|
15
15
|
selected: readonly TypeaheadOption<T>[];
|
|
16
|
-
|
|
16
|
+
dropdownOpen?: boolean;
|
|
17
17
|
autoComplete: string;
|
|
18
18
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
19
19
|
onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -67,7 +67,7 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
67
67
|
autoFocus,
|
|
68
68
|
multiple,
|
|
69
69
|
name,
|
|
70
|
-
|
|
70
|
+
dropdownOpen,
|
|
71
71
|
placeholder,
|
|
72
72
|
selected,
|
|
73
73
|
value,
|
|
@@ -89,7 +89,7 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
89
89
|
autoFocus={autoFocus}
|
|
90
90
|
placeholder={hasPlaceholder ? placeholder : ''}
|
|
91
91
|
aria-autocomplete="list"
|
|
92
|
-
aria-expanded={
|
|
92
|
+
aria-expanded={dropdownOpen}
|
|
93
93
|
aria-haspopup="listbox"
|
|
94
94
|
aria-controls={`menu-${typeaheadId}`}
|
|
95
95
|
autoComplete={autoComplete}
|