Skip to content

Commit

Permalink
[Autocomplete] Fix usage of Home/End keys (#18338)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weslen do Nascimento authored and oliviertassinari committed Nov 12, 2019
1 parent c02a221 commit 24840a8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,18 @@ export default function useAutocomplete(props) {

switch (event.key) {
case 'Home':
// Prevent scroll of the page
event.preventDefault();
changeHighlightedIndex('start', 'next');
if (popupOpen) {
// Prevent scroll of the page
event.preventDefault();
changeHighlightedIndex('start', 'next');
}
break;
case 'End':
// Prevent scroll of the page
event.preventDefault();
changeHighlightedIndex('end', 'previous');
if (popupOpen) {
// Prevent scroll of the page
event.preventDefault();
changeHighlightedIndex('end', 'previous');
}
break;
case 'PageUp':
// Prevent scroll of the page
Expand Down

0 comments on commit 24840a8

Please sign in to comment.