-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Modal autofocus option doesn't work #2737
Comments
This code is just wrong. Thanks for the report, and sorry about that. |
… to outside function so it can be called manually
What about making this autofocus feature more flexible by allowing it to receive a boolean or a function/callback that would set the focus? I am thinking about scenarios where I wouldn't want to the set focus on the first input or where my first field isn't exactly an input (e.g a select2 dropdown). |
You always have the "show" action callback to perform more complex tasks that's the one i'm using now to focus the first input. By the way, are you sure $(':input') doesn't match a select2 dropdown. I've tried here https://select2.github.io/examples.html but without a clear answer |
But we have a multi select 😄 In all seriousness, I think using callbacks and custom logic makes sense. |
Right now I am using the show action callback for this, but it doesn't seems quite "right" to me. Also it took me sometime to figure I could pass a callback to it, since there's no example of this in the documentation. Maybe something with an onVisible callback would make more sense, but it will be called before autofocus :( |
@jlukic multi select currently doesn't have all the features I need :( |
What features are missing? |
I created an issue about they: #2746 |
Met the problem. Hope 2.1 will come soon. |
The paramenter "autofocus" for the modal() module has no effect.
I have a modal dialog with a login form inside and and none of the input fields gets focused after show.
The code of modal.js reveals that the problem seems to be the use of $module.filter(':input') to select the input elements. In my case $module is the jquery-wrapped "div" containing all the dialog contents and filter's job is to filter an array of elements by applying a selector to them, not that of "finding" child elements.
The text was updated successfully, but these errors were encountered: