Closed heidid closed 10 years ago
What version are you using? 2.0.1 doesn't set focus properly, but it also doesn't open multiple versions of the same modal:
Ah, I see my problem. I was initiating a new picoModal every time (fiddle), so of course multiple modals would appear. Thanks.
Followup: I added a section to the readme to make sure this use case is clear: 84ebf91259a12cd8380921fd43bcff658de63002
Since a page can be navigated by keyboard, pressing [enter] or [space] will continue to create more instances of the same modal. For example, attach the modal to an
onclick
event listener, and pressing [enter] to click the button multiple times will result in multiple modals overlayed on top of each other. A solution would be to change thefocus
to the modal when created.