- In the current tab when pressing
Enter - In a new tab when pressing
Cmd+EnterorCtrl+Enter - In a new window when pressing
Shift+Enter
Usage
To activate keyboard navigation, you need to implement agetItemUrl function in each of your sources to provide the target URL.
It tells the Navigator API which link to open on Enter.
JavaScript
Location API (see default implementation in the preceding code example). If youβre relying on native document-based routing, this should work out of the box. If youβre using custom client-side routing, you can use the Navigator API to connect your autocomplete with it.
For example, if youβre using Autocomplete in a Gatsby website,
you can use their navigate helper to go to internal pages without refreshing the page.
JavaScript
Reference
The function called when a URL should open in the current page (when pressing
Enter).The function called when a URL should open in a new tab (when pressing
Ctrl+Enter or Cmd+Enter).The function called when a URL should open in a new window (when pressing
Shift+Enter).