diff --git a/lib/gui/components/drive-selector/controllers/drive-selector.js b/lib/gui/components/drive-selector/controllers/drive-selector.js index 09cd5e54..2cc61249 100644 --- a/lib/gui/components/drive-selector/controllers/drive-selector.js +++ b/lib/gui/components/drive-selector/controllers/drive-selector.js @@ -251,4 +251,29 @@ module.exports = function ( this.getDriveStatuses = this.memoizeImmutableListReference((drive) => { return this.constraints.getDriveImageCompatibilityStatuses(drive, this.state.getImage()) }) + + /** + * @summary Keyboard event drive toggling + * @function + * @public + * + * @description + * Keyboard-event specific entry to the toggleDrive function. + * + * @param {Object} drive - drive + * @param {Object} $event - event + * + * @example + *
+ * Tab-select me and press enter or space! + *
+ */ + this.keyboardToggleDrive = (drive, $event) => { + console.log($event.keyCode) + const ENTER = 13 + const SPACE = 32 + if (_.includes([ ENTER, SPACE ], $event.keyCode)) { + this.toggleDrive(drive) + } + } } diff --git a/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html b/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html index ce8a1a07..7507df61 100644 --- a/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html +++ b/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html @@ -1,6 +1,6 @@ @@ -86,6 +90,7 @@