codyhouse / codyhouse-framework

A lightweight front-end framework for building accessible, bespoke interfaces.
https://codyhouse.co/
MIT License
1.16k stars 171 forks source link

Make tabFocus a named function #65

Closed MaikelGG closed 4 years ago

MaikelGG commented 4 years ago

I noticed that focusTab in utils.js get executed once on page load. But because it is an anonymous function you cannot call it again when you add elements to the DOM. In my case an ajax 'account registration modal' gets loaded with the 'Password Visibility Control' component. I think my case is not that unique so maybe it is worth considering changing this to a named function. Or if there is even a better way to do this I am glad to hear it.

var tabFocus;
(tabFocus = function() {
...
})();

call it in other functions (re-attach event listeners):

tabFocus();
claudia-romano commented 4 years ago

Hi there, yes that's a good point. We'll make sure to include it in the next framework release. Thanks!

sebastiano-guerriero commented 4 years ago

updated! https://github.com/CodyHouse/codyhouse-framework/releases/tag/v2.8.0