From 0050cb830c3d4c7139f4e78b35a07297cd86ba25 Mon Sep 17 00:00:00 2001 From: Sliman Said Date: Fri, 8 Nov 2019 17:21:43 +0100 Subject: [PATCH] [useAutocomplete] Handle Opera fullscreen mode (#18275) --- .../src/useAutocomplete/useAutocomplete.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js index 2ebd2905d3ac7f..095d4bd91815d5 100644 --- a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js +++ b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js @@ -537,9 +537,15 @@ export default function useAutocomplete(props) { break; case 'Escape': if (popupOpen) { + // Avoid Opera to exit fullscreen mode. + event.preventDefault(); + // Avoid the Modal to handle the event. event.stopPropagation(); handleClose(event); - } else if (clearOnEscape) { + } else if (clearOnEscape && inputValue !== '') { + // Avoid Opera to exit fullscreen mode. + event.preventDefault(); + // Avoid the Modal to handle the event. event.stopPropagation(); handleClear(event); }