This causes weird UX:

- In firefox for example, after each pause in typing inside the filter field the search-as-you-type feature fires up and focus switches to the browser search box. One needs to click inside the filter field again and again in order to continue filtering the list of files.

- Hitting the backspace takes you to the previous page. This forces people to re-edit and re-click the link that launches the "Select a file" dialog. A lot more clicks for the user to get back to they were.

#5 media-exposed_field_focus-2084287-5.patch2.29 KBemacoti
PASSED: [[SimpleTest]]: [MySQL] 1,095 pass(es). View
#3 media-exposed_field_focus-2084287-3.patch2.35 KBemacoti
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch media-exposed_field_focus-2084287-3.patch. Unable to apply patch. See the log in the details link for more information. View
#2 media-file-name-focus-2084287-2.patch1000 bytesdsnopek
PASSED: [[SimpleTest]]: [MySQL] 989 pass(es). View


klonos’s picture

Issue summary: View changes more example glitch

dsnopek’s picture

This appears to be the result of an issue in Views (since this is just using the 'autosubmit' feature of Views): #1217948: exposed filter with autosubmit and ajax loses keyboard focus

It doesn't appear like that issue is anywhere near consensus on how to solve it, so working around it in Media is probably the most viable approach. Simply setting the focus back to the input after auto submit has been triggered seems like the easiest approach...

dsnopek’s picture

Status: Active » Needs review
Issue tags: +panopoly
1000 bytes
PASSED: [[SimpleTest]]: [MySQL] 989 pass(es). View

Here's a patch that works in my testing! Please let me know what you think.

We'll likely start using this in Panopoly soon-ish.

emacoti’s picture

2.35 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch media-exposed_field_focus-2084287-3.patch. Unable to apply patch. See the log in the details link for more information. View

I tried the patch and it solved the issue with the lost focus. But, after more testing was done, I found another issue which is related to timing and the auto-submit provided for ctools.
The test to reproduce was: I just type some characters and wait until the ajax request starts. Then, when the request is almost done its processing, I just type a character again and this starts the auto-submit functionality, but javascript functionality, that one that handle the form submit doing an ajax call instead of the regular form submit, its not in place so the submit perform a submit over the action form param ("/") and it breaks the library view leaving us without the functionality and needing to reload the page.

So, I made a fix for this based on the previous patch and adding some functionality that forces the browser to lose the focus and prevent user event keys. Once the Ajax request is finished, we return the focus to the field. This way, the user can't brake the library anymore and he still recover his selected field focus after ajax was done.

I made several tests and it works as expected. Any feedback welcomed.

Status: Needs review » Needs work

The last submitted patch, 3: media-exposed_field_focus-2084287-3.patch, failed testing.

emacoti’s picture

2.29 KB
PASSED: [[SimpleTest]]: [MySQL] 1,095 pass(es). View

The same patch with the right version of the media module for this issue.

emacoti’s picture

Status: Needs work » Needs review

  • joseph.olstad committed 5171ff8 on 7.x-2.x authored by emacoti
    Issue #2084287 by emacoti, dsnopek: The "File name" filter field in the...
joseph.olstad’s picture

Status: Needs review » Fixed

fixed in 7.x-2.x dev branch