"View Library" uses defaults Views AJAX for "exposed filters" form. This implementation is very inefficient in terms of data transfer and in terms of user experience as it replaces the form itself.

Main issues:
1) user looses keyboard focus; for instance next "Return" key-press will redirect to previous page
2) user doesn't know when AJAX call has been initiated and when AJAX callback returns anything written inside the field -after the call- will be overriden with previous AJAX state.

Attached patch is only a workaround to return focus back to the search field once the AJAX call returns, and also sets cursor position at the end of the string. It eliminates issue 1 and slightly issue 2.

CommentFileSizeAuthor
media-lost-focus.patch1.4 KBpeterpajchl

Comments

peterpajchl’s picture

Status: Active » Needs review
dave reid’s picture

This is by design how the Views AJAX auto-submit works. Wouldn't this be best filed as a patch against Views?

dave reid’s picture

Status: Needs review » Postponed (maintainer needs more info)
dave reid’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
gmclelland’s picture

Status: Closed (won't fix) » Active

I think this might be solved by splitting the exposed filters of the "View Library" into a block that is embedded above the actual "View library" view.

On most views that have exposed filters you will see the option for "Expose the filters as a block" under "Advanced", but you don't see this when editing the "View Library" view.

See my comment here http://drupal.org/node/1319528#comment-5605672

#1217948: exposed filter with autosubmit and ajax loses keyboard focus: exposed filter with autosubmit and ajax loses keyboard focus - seems to suggest that when building your views you should always have your exposed filters be in a block instead of the view itself. Otherwise the autocomplete input will lose keyboard focus after every ajax submit. This happens because the whole contents of the view including the exposed filters get replaced. I'm experiencing this with the media module's "View library". Try typing part of the file name, an ajax request will be fired. Notice how you have to click back into the input field before you can continue typing the file name again?

To possibly solve that issue, can media module "View library" create it's exposed filters in a block that gets placed above the view?

There wouldn't be a need for the patch attached to this issue because the you wouldn't ever lose the focus.

Hope that helps

Here is the related issues:
#1396700: Media Browser "View Library" Submit button redirects back to homepage, instead of closing modal and adding media file
#1319528: Media browser view library exposed form submit problem

devin carlson’s picture

Status: Active » Closed (fixed)

Separate issues have been filed for each of the problems outlined in the origin issue so I'm closing this "meta" issue.