Skip to content

Commit f97352e

Browse files
committed
Merge remote-tracking branch 'origin/master' into pr/theGirrafish/20110
2 parents 87c061e + 7285bbd commit f97352e

File tree

11 files changed

+234
-188
lines changed

11 files changed

+234
-188
lines changed

azure-pipelines.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ trigger:
66
- l10n
77
- dependabot/*
88

9+
# https://developercommunity.visualstudio.com/comments/949241/view.html
10+
pr:
11+
branches:
12+
include:
13+
- '*'
14+
915
pool:
1016
vmImage: 'ubuntu-latest'
1117

docs/next.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ const workspaceRoot = path.join(__dirname, '../');
1313
const reactMode = 'legacy';
1414

1515
module.exports = {
16+
typescript: {
17+
// Motivated by https://github.com/zeit/next.js/issues/7687
18+
ignoreDevErrors: true,
19+
ignoreBuildErrors: true,
20+
},
1621
webpack: (config, options) => {
1722
const plugins = config.plugins.concat([
1823
new webpack.DefinePlugin({

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"cross-fetch": "^3.0.4",
6565
"css-loader": "^3.1.0",
6666
"css-mediaquery": "^0.1.2",
67-
"date-fns": "2.10.0",
67+
"date-fns": "2.11.0",
6868
"docsearch.js": "^2.6.3",
6969
"doctrine": "^3.0.0",
7070
"express": "^4.17.1",

docs/pages/api-docs/autocomplete.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
3434
| <span class="prop-name">clearText</span> | <span class="prop-type">string</span> | <span class="prop-default">'Clear'</span> | Override the default text for the *clear* icon button.<br>For localization purposes, you can use the provided [translations](/guides/localization/). |
3535
| <span class="prop-name">closeIcon</span> | <span class="prop-type">node</span> | <span class="prop-default">&lt;CloseIcon fontSize="small" /></span> | The icon to display in place of the default close icon. |
3636
| <span class="prop-name">closeText</span> | <span class="prop-type">string</span> | <span class="prop-default">'Close'</span> | Override the default text for the *close popup* icon button.<br>For localization purposes, you can use the provided [translations](/guides/localization/). |
37-
| <span class="prop-name">debug</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the popup will ignore the blur event if the input if filled. You can inspect the popup markup with your browser tools. Consider this option when you need to customize the component. |
37+
| <span class="prop-name">debug</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the popup will ignore the blur event if the input is filled. You can inspect the popup markup with your browser tools. Consider this option when you need to customize the component. |
3838
| <span class="prop-name">defaultValue</span> | <span class="prop-type">any<br>&#124;&nbsp;array</span> | <span class="prop-default">props.multiple ? [] : null</span> | The default input value. Use when the component is not controlled. |
3939
| <span class="prop-name">disableClearable</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the input can't be cleared. |
4040
| <span class="prop-name">disableCloseOnSelect</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the popup won't close when a value is selected. |

docs/src/pages/components/autocomplete/autocomplete.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ To fully take advantage of type inference, you need to set the `multiple` prop t
220220
See [this discussion](https://github.com/mui-org/material-ui/pull/18854#discussion_r364215153) for more details.
221221
TypeScript might solve this bug in the future.
222222

223+
### ListboxComponent
224+
225+
If you provide a custom `ListboxComponent` prop, you need to make sure that the intended scroll container has the `role` attribute set to `listbox`. This ensures the correct behavior of the scroll, for example when using the keyboard to navigate.
226+
223227
## Accessibility
224228

225229
(WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#combobox)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@babel/preset-react": "^7.8.3",
5454
"@babel/register": "^7.8.6",
5555
"@rollup/plugin-replace": "^2.3.1",
56-
"@testing-library/dom": "^6.8.1",
56+
"@testing-library/dom": "^7.0.3",
5757
"@testing-library/react": "^9.3.2",
5858
"@testing-library/react-hooks": "3.2.1",
5959
"@types/chai": "^4.2.3",

packages/material-ui-lab/src/Autocomplete/Autocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ Autocomplete.propTypes = {
542542
*/
543543
closeText: PropTypes.string,
544544
/**
545-
* If `true`, the popup will ignore the blur event if the input if filled.
545+
* If `true`, the popup will ignore the blur event if the input is filled.
546546
* You can inspect the popup markup with your browser tools.
547547
* Consider this option when you need to customize the component.
548548
*/

packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,29 @@ describe('<Autocomplete />', () => {
456456
});
457457
});
458458

459+
describe('prop: clearOnEscape', () => {
460+
it('should clear on escape', () => {
461+
const handleChange = spy();
462+
render(
463+
<Autocomplete
464+
{...defaultProps}
465+
onChange={handleChange}
466+
clearOnEscape
467+
multiple
468+
value={['one']}
469+
options={['one', 'two']}
470+
renderInput={params => <TextField {...params} autoFocus />}
471+
/>,
472+
);
473+
474+
fireEvent.keyDown(document.activeElement, { key: 'Escape' });
475+
fireEvent.keyDown(document.activeElement, { key: 'Escape' });
476+
477+
expect(handleChange.callCount).to.equal(1);
478+
expect(handleChange.args[0][1]).to.deep.equal([]);
479+
});
480+
});
481+
459482
describe('when popup open', () => {
460483
it('closes the popup if Escape is pressed ', () => {
461484
const handleClose = spy();

packages/material-ui-lab/src/useAutocomplete/useAutocomplete.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface UseAutocompleteCommonProps<T> {
5353
*/
5454
componentName?: string;
5555
/**
56-
* If `true`, the popup will ignore the blur event if the input if filled.
56+
* If `true`, the popup will ignore the blur event if the input is filled.
5757
* You can inspect the popup markup with your browser tools.
5858
* Consider this option when you need to customize the component.
5959
*/

packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ export default function useAutocomplete(props) {
648648
// Avoid the Modal to handle the event.
649649
event.stopPropagation();
650650
handleClose(event);
651-
} else if (clearOnEscape && inputValue !== '') {
651+
} else if (clearOnEscape && (inputValue !== '' || (multiple && value.length > 0))) {
652652
// Avoid Opera to exit fullscreen mode.
653653
event.preventDefault();
654654
// Avoid the Modal to handle the event.
@@ -975,7 +975,7 @@ useAutocomplete.propTypes = {
975975
*/
976976
componentName: PropTypes.string,
977977
/**
978-
* If `true`, the popup will ignore the blur event if the input if filled.
978+
* If `true`, the popup will ignore the blur event if the input is filled.
979979
* You can inspect the popup markup with your browser tools.
980980
* Consider this option when you need to customize the component.
981981
*/

0 commit comments

Comments
 (0)