Refactoring dialog.overlay in preparation for Modal & better keyboard accessibility

Refactoring dialog.overlay in preparation for Modal & better keyboard accessibility

Hi,

we - that is, I and my team - need to improve the keyboard accessibility & modality of the Dialog widget in order to use it.

I was originally thinking of binding the "focus" event as it bubbles up to the document - which would remove a lot of the expense of trying to get all "focusables" in the page or any technique like that.  Weirdly, this seems to only work for focus() events triggered by jQuery, rather than native ones.

That aside, would you be able to accept a patch that kept (or improved) the functionality of the Overlay / Modal, although possibly rewiring some of the internals?

Our thoughts are:

  • move all "modality" controls out of 'dialog.open' and into 'dialog.overlay.open'
  • break the dependence of dialog.overlay on being passed a dialog, and let it take instead any dom element
  • initially we will not be concerned over multiple concurrent overlays, but we will need to address this in the future - ideally we would have a single overlay that is given "state" to know which element it is currently working with and which others are in it's stack.  An alternative implementation would be some class-level variables that kept track of what overlays were in existence and to have the current overlay turn on / off the previous one as required.
  • we have in the past created a highly accessible, responsive and robust "foscusable" behaviour (which supports modality) so would ideally like to port some of the good bits of that over (see Focusable on github)
Is the best way to fork on github and submit a pull request, or point to the commit on here?

Thanks

Pete