New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
2 participants
@roman-e

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

This comment has been minimized.

Show comment
Hide comment
@gabrielschulhof

gabrielschulhof Dec 15, 2014

Contributor

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).

Contributor

gabrielschulhof commented Dec 15, 2014

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

This comment has been minimized.

Show comment
Hide comment
@gabrielschulhof

gabrielschulhof Dec 15, 2014

Contributor

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.

Contributor

gabrielschulhof commented Dec 15, 2014

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

This comment has been minimized.

Show comment
Hide comment
@gabrielschulhof

gabrielschulhof Dec 15, 2014

Contributor

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

Contributor

gabrielschulhof commented Dec 15, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment