thomasp85/shinyFiles

Feature request: select file and close modal on double click

Closed this issue · 4 comments

vnijs commented

Currently double click toggles file selection. Why not have double click select and close the modal?

Sounds good to me

Maybe fold #63 into an update on interaction possibilities

I’ve forgotten - can you navigate the selection with the arrow keys? If not, that would be a natural addition as well

vnijs commented

The selecting and toggeling code is pretty complex javascript, at least for me. I'm not sure where to make changes or how to test the result is still working as expected. I did try adding the last 4 lines below to address #63 but that had no effect.

modal.find('.sF-directory').on('dblclick', function() {
  $(this).toggleClass('selected', true);
  openDir($(element), modal, this);
});
modal.find('.sF-directory').on('keyup', function(event) {
  if (event.keyCode == 13) {
    $(this).toggleClass('selected', true);
    openDir($(element), modal, this);
  }
});

It would also be great if something like the code below worked as an alternative to clicking the Select button in the modal ... and perhaps esc to cancel/close the modal. This code doesn't work however and, again, I'm not sure how to test or fix.

modal.find('.sF-responseButtons #sF-selectButton').on('keyup', function(event) {
  if (event.keyCode == 13) {
    selectFiles(button, modal);
  }
})