似乎使用日期选择器的每个操作都不会将焦点返回到日期选择器输入或按钮,因此选项卡索引返回到第一个元素。
您可以通过官方演示为例:https://material.angularjs.org/latest/demo/datepicker
查看源代码和调试 - 似乎焦点操作是在相关元素上触发的,但即便如此 - 焦点更改为文档正文。
/** Close the floating calendar pane. */
DatePickerCtrl.prototype.closeCalendarPane = function() {
if (this.isCalendarOpen) {
var self = this;
self.calendarPaneOpenedFrom.focus();
self.calendarPaneOpenedFrom = null;
if (self.openOnFocus) {
// Ensures that all focus events have fired before detaching
// the calendar. Prevents the calendar from reopening immediately
// in IE when md-open-on-focus is set. Also it needs to trigger
// a digest, in order to prevent issues where the calendar wasn't
// showing up on the next open.
this.$mdUtil.nextTick(detach);
} else {
detach();
}
}
function detach() {
self.detachCalendarPane();
self.isCalendarOpen = false;
self.ngModelCtrl.$setTouched();
self.documentElement.off('click touchstart', self.bodyClickHandler);
window.removeEventListener('resize', self.windowResizeHandler);
}
};
10 倍埃拉德。
日期选取器焦点问题中存在一个错误,因为内部的 SVG 元素没有传播焦点事件。
由克里斯贝托解决。
编号 : https://github.com/crisbeto/material/commit/e8d4ad217dd2ad5a8e8875f9bdc1269679667e3b