Skip to content

Updates to Util plugin

Compare
Choose a tag to compare
@geotrev geotrev released this 08 Jul 05:38
· 252 commits to master since this release

This is a pretty minor update that rewrites a few things with the js components. There is no outward difference in the API, with the exception of utils.

Previously, the modal, accordion, and dropdown component plugins would extend from a Util class for things like focus trapping. I slowly began pulling out certain helper functions related to dom manipulation, so I figured, why not go all the way? In a functional programming world, this creates a more succinct separation of concerns, of course.

So now there's ContextUtil, which is initialized separately for each component plugin, similar to if it were extended. The main benefit here is it sets up the potential to allow better focus trapping behavior for components like the accordion, which depend on arrow trapping but not tab trapping for each accordion instance. Instead of initializing a trap when a button is focused, it can exist at all times for each instance and maintain WCAG standard.

Again, there is no major difference to notice with component plugins. But instead of calling Utils.captureFocus(...), you can now use ContextUtil.captureFocus(...).

Feel free to report issues if you come across them. Thanks!