Menu

#45 keyboard events are directed to background page

open
nobody
None
2016-09-30
2015-03-01
Anonymous
No

Originally created by: ajoslin103

When a modal is open, and the page behind it is obscured

While you cannot click on anything on that page

You can still tab to move the tab-focus around on the page -- and hit spacebar/enter to trigger the highlighted item

Discussion

  • Anonymous

    Anonymous - 2015-03-04

    Originally posted by: dwmkerr

    Are you sure this is an issue with the angular modal service and not simply an issue with the bootstrap modal?

     
  • Anonymous

    Anonymous - 2015-03-04

    Originally posted by: ajoslin103

    I went to the bootstrap modal demo and did not see the same problem, theirs is directing the tab keys into the modal

    Your demo page has the issue of the tab key cyclng thru items on the page

    AngularUI has the same problem, the tab key cycles thru items on the page

    Maybe Angular is 'helping' ?

     
  • Anonymous

    Anonymous - 2015-03-04

    Originally posted by: dwmkerr

    Possibly, although it might be more that the bootstrap documentation page
    has a little bit of JavaScript to stop it from happening

    On 4 March 2015 at 15:03, allen joslin notifications@github.com wrote:

    I went to the bootstrap modal demo and did not see the same problem,
    theirs is directing the tab keys into the modal

    Your demo page has the issue of the tab key cyclng thru items on the page

    AngularUI has the same problem, the tab key cycles thru items on the page

    Maybe Angular is 'helping' ?


    Reply to this email directly or view it on GitHub
    https://github.com/dwmkerr/angular-modal-service/issues/45#issuecomment-77162376
    .

     
  • Anonymous

    Anonymous - 2015-03-04

    Originally posted by: ajoslin103

    I just ran thru the 1st 3 pages of google results on: bootstrap modal

    they all have the same problem except for this one:

    http://codepen.io/SitePoint/pen/KkHyw

    I sure hope that you can figure something out and add it to your code, I'm behind the 8-ball on a big project and your modals are otherwise working wonderfully for me...

    If I can be of any help let me know!

     
  • Anonymous

    Anonymous - 2015-03-05

    Originally posted by: dwmkerr

    Just make sure that when you tab past the last focusable element you manually suppress the event and go to the first focusable element in the modal:

    http://jsfiddle.net/dwmkerr/5botatz3/

    You can probably event generalise to find the last focusable element in a container via a selector.

     
  • Anonymous

    Anonymous - 2015-03-05

    Originally posted by: ajoslin103

    I just went over to the AngularUI project and they have been trying to find the best solution for a while now. [https://github.com/angular-ui/bootstrap/issues/738]

    They point out: Modal.prototype.enforceFocus() in Bootstrap 3 (which I found being called inside the Modal.show() ) and claim that it does the trick...

    Now why is that not working for everyone who uses Modal ?

     
  • Anonymous

    Anonymous - 2016-09-30

    Originally posted by: joelcdoyle

    This was also a problem with Angular UI Bootstrap's modal for a while (https://github.com/angular-ui/bootstrap/issues/738) but some contributers eventually fixed it. It does not appear to be an easy task. I will take stab at it, because I need it for a custom modal that I am making. If I get it working I'll submit a PR.

     

Log in to post a comment.