Skip to content
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

Make Modal.enforceFocus easier to override/exempt #19850

Closed
zenorocha opened this issue May 6, 2016 · 3 comments
Closed

Make Modal.enforceFocus easier to override/exempt #19850

zenorocha opened this issue May 6, 2016 · 3 comments
Labels

Comments

@zenorocha
Copy link
Contributor

For many years, dozens of third-party libraries have been facing the same issue with Bootstrap's modal. The answer so far has been "override enforceFocus" #16050 #12216 #11686 #10610 #8537 #7371 #6996 #5114

That led to many apps adding this line to their code:

$.fn.modal.Constructor.prototype.enforceFocus = function() {};

Once they upgrade to Bootstrap 4, this line will no longer work. They will need to figure out that it changed to:

$.fn.modal.Constructor.prototype._enforceFocus = function() {};

Instead of asking people to monkey patch their projects, shouldn't this functionality be revisited and fixed? Maybe starting from #12142?

@whodabudda
Copy link

Oy!! Days of trolling through code and finally stumbled on this! Thank you so much for the post. What a difference a character makes. It would be nice if 3rd party vendors kept the old interface and aliased it to the new, at least for a few releases as deprecated. I was ready to toss out bootstrap modals altogether.

@Johann-S
Copy link
Member

Johann-S commented May 3, 2017

With focus option to false, enforceFocus isn't called see : http://v4-alpha.getbootstrap.com/components/modal/#options + https://github.com/twbs/bootstrap/blob/v4-dev/js/src/modal.js#L251

@guilhermecfviana
Copy link

Thank you very much @zenorocha !!!

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

No branches or pull requests

5 participants