We currently have a telerik datepicker (and timepicker) displayed inside a bootstrap modal, and while it works (mostly) fine, I've discovered that accessibility keyboard controls (enabled via setting EnableAriaSupport and EnableKeyboardNavigation to True) do not work. The controls work fine in context of a datepicker outside of these modals.
Upon further investigation, it seems as though the telerik process is adding a new div to the dom when we open the datepicker calendar, which presumably is firing some low-level bootstrap event or process that I'm unaware of to force focus back to the modal... and in this case away from the datepicker that's appearing over it.
Does anyone know of a way to prioritize keyboard control focus to remain on the added datepicker calendar that appears instead of reverting back to the top of the modal?
Things I've tried include:
- Setting the modal's data-keyboard and data-focus properties to false (which did nothing except disabling people to press escape to close the modal)
- setting the date-picker's z-index arbitrarily high (despite it already rendering on top of the modal to begin with
- setting some properties for bootstrap-adjacent things in the off chance that they might work (such as Vue.JS). These, predictably, did nothing.
- fiddled with some raw JS events that might have impacted the process. These did not get hit upon loading the datepicker when test breakpoints were added to them
- setting a hidden field on the datepicker's sub-controls with the ID "hasControlOnModal" to True. This was preexisting code from the 2009 version of the datepicker that I'm currently trying to get away from, and doesn't seem to do anything as far as I can tell.
- confirming in VB code that the controls in and out of the modal are built the same way (they run through the same code)
- Tried to catch the calendar opening and manually force focus in JS via the OnPopupOpening event (this doesn't work as the documentation points out this event is just BEFORE the calendar loads into the dom... I need it to be there so I can use jquery's .focus() on it.
It's worth noting that I do not have the option to swap away from the current way we build modals and use a telerik modal at this time.
The datepicker, opened with keyboard controls, as it appears outside
the modal (note the black box around the calendar, denoting that the
control is in-focus of the keyboard and is usable via arrow key
modal with a datepicker attached to it. The focus is on the invisible
"title" of the modal, which announces to screen readers that there's a
modal open. hitting "tab" here shifts the focus to the "close" button.
down to the datepicker works as intended, and upon hitting "enter" on
the open calendar button, you're presented with this screen:
Notice that the calendar does not have the focused black box around it, as the focus has shifted back to the top of the bootstrap modal. Keyboard controls do not work. Hitting "tab" from here will once again move the focus to the modal's "close" button. There is no way for me to tab into the calendar control.