提交 79e075ec 编写于 作者: I isidor

fix tests

上级 17202755
...@@ -47,6 +47,10 @@ export function setARIAContainer(parent: HTMLElement) { ...@@ -47,6 +47,10 @@ export function setARIAContainer(parent: HTMLElement) {
* Given the provided message, will make sure that it is read as alert to screen readers. * Given the provided message, will make sure that it is read as alert to screen readers.
*/ */
export function alert(msg: string): void { export function alert(msg: string): void {
if (!ariaContainer) {
return;
}
// Use alternate containers such that duplicated messages get read out by screen readers #99466 // Use alternate containers such that duplicated messages get read out by screen readers #99466
if (alertContainer.textContent !== msg) { if (alertContainer.textContent !== msg) {
dom.clearNode(alertContainer2); dom.clearNode(alertContainer2);
...@@ -61,6 +65,10 @@ export function alert(msg: string): void { ...@@ -61,6 +65,10 @@ export function alert(msg: string): void {
* Given the provided message, will make sure that it is read as status to screen readers. * Given the provided message, will make sure that it is read as status to screen readers.
*/ */
export function status(msg: string): void { export function status(msg: string): void {
if (!ariaContainer) {
return;
}
if (isMacintosh) { if (isMacintosh) {
alert(msg); // VoiceOver does not seem to support status role alert(msg); // VoiceOver does not seem to support status role
} else { } else {
...@@ -75,10 +83,6 @@ export function status(msg: string): void { ...@@ -75,10 +83,6 @@ export function status(msg: string): void {
} }
function insertMessage(target: HTMLElement, msg: string): void { function insertMessage(target: HTMLElement, msg: string): void {
if (!ariaContainer) {
return;
}
dom.clearNode(target); dom.clearNode(target);
if (msg.length > MAX_MESSAGE_LENGTH) { if (msg.length > MAX_MESSAGE_LENGTH) {
msg = msg.substr(0, MAX_MESSAGE_LENGTH); msg = msg.substr(0, MAX_MESSAGE_LENGTH);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册