Added keyboard functionality to gallery.js