Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Filter widget from List in Popup always gets the focus #7870

Closed
roman-e opened this issue Dec 10, 2014 · 3 comments
Closed

Filter widget from List in Popup always gets the focus #7870

roman-e opened this issue Dec 10, 2014 · 3 comments
Assignees
Milestone

Comments

@roman-e
Copy link

roman-e commented Dec 10, 2014

Hi

First, here's a jsfiddle with the problem:
http://jsfiddle.net/b1c75sbb/3/

What is the problem?
When I scroll the list and click into the list, it jumps back to the top because the filter widget gets the focus. When I add click events to these div elements, the event doesn't fire when the list already scrolled a bit.

So is it intended to work like this and it's normal for the filter widget to get the focus or is it a bug?

@gabrielschulhof
Copy link

Restated as a jsbin: http://jsbin.com/buniru/1/
Behaviour in 1.4.4: http://jsbin.com/buniru/2/
Behaviour in 1.4.5: http://jsbin.com/buniru/3/

I'm reluctant to call this a regression, but I'm going to treat it as one, because I think it was introduced by the fix for #7533 (#7757).

@gabrielschulhof gabrielschulhof self-assigned this Dec 15, 2014
@gabrielschulhof gabrielschulhof added this to the 1.5.0 milestone Dec 15, 2014
@gabrielschulhof
Copy link

The reason the textinput is getting focus is that, when you click on one of the divs underneath the textinput, the page gets the focus, so the popup's focus restriction handling kicks in, giving the first tabbable item inside the popup the focus - this is the textinput.

In 1.4.4 this did not happen because the popup itself was given a tabindex, so, when you clicked inside it, the focus restriction did not reassign focus because it's OK for the popup itself to gain focus.

I'm reluctant to reintroduce the tabindex to the popup for fear of causing the Android blue focus flash to reappear.

@glurak15 the solution is to give the popup a tabindex while it's open:

    $( document )
      .on( "popupafteropen", "#popupBasic", function() {
        $( "#popupBasic" ).attr( "tabindex", 0 );
      })
      .on( "popupafterclose", "#popupBasic", function() {
        $( "#popupBasic" ).removeAttr( "tabindex" );
      });

http://jsbin.com/buniru/4/ shows how it works.

@gabrielschulhof
Copy link

@glurak15 Needless to say, be aware that this may cause undesired blue focus flashes on Android :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants