Blazor File Upload - Keyboard Navigation
Or drop files here
File Upload functionalities can be made interactive using keyboard shortcuts. In the below sample, various key combinations can be used to interact with the File Upload component.
The File Upload component supports the following keyboard shortcuts to initiate various actions:
Focus:
- Alt + J - Focuses on the first component of the sample.
Selection:
- Enter - Triggers the corresponding action to the button element.
Navigation:
- Tab - Moves focus to the next element.
- Shift + Tab - Moves focus to the previous element.
- Esc - Closes the file browser dialog and cancels the upload when the file is dropped.
In this example, the backend service used in the saveUrl and removeUrl endpoints for saving and removing files is intended for demonstration purposes only. The uploaded files are subjected to thorough validation, including verification of file names and the application of security checks. Therefore, this service is not recommended for production use, and the configuration of a custom backend save and remove service is advised.