gpt4 book ai didi

javascript - 在进行任何基于键盘的操作后, Angular Material (日期选择器)焦点将放在 body 上

转载 作者:行者123 更新时间:2023-12-03 11:15:53 25 4
gpt4 key购买 nike

似乎所有使用日期选择器的操作都不会将焦点返回到日期选择器输入或按钮,因此选项卡索引又回到了第一个元素。

您可以以官方演示为例: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元素未传播焦点事件,因此在datepicker焦点问题中存在一个错误。

由crisbeto解决。

引用:https://github.com/crisbeto/material/commit/e8d4ad217dd2ad5a8e8875f9bdc1269679667e3b

关于javascript - 在进行任何基于键盘的操作后, Angular Material (日期选择器)焦点将放在 body 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38226721/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com