Skip to content

Commit f651c7d

Browse files
authored
Fixing A11y issues in screencast (#3594)
Fixing 2 accessibility issues in screencast window: Refresh button was not reading the role Close infobar was not providing enough information for narrator.
1 parent a9f787c commit f651c7d

File tree

2 files changed

+481
-479
lines changed

2 files changed

+481
-479
lines changed

src/screencast/infobar.ts

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
2-
// Licensed under the MIT License.
3-
4-
import { html, render } from 'lit-html';
5-
import { createRef, ref } from 'lit-html/directives/ref.js'
6-
import { styleMap, StyleInfo } from 'lit-html/directives/style-map.js';
7-
8-
interface InfobarProps {
9-
message: string;
10-
}
11-
12-
export default class InfobarComponent {
13-
#buttonRef = createRef();
14-
#message: string;
15-
#container: HTMLElement | undefined;
16-
17-
constructor(props: InfobarProps, container?: HTMLElement) {
18-
this.#message = props.message;
19-
this.#container = container;
20-
this.#update();
21-
}
22-
23-
#update(styles?: StyleInfo) {
24-
let customStyles = styles ?? {
25-
display: 'flex'
26-
};
27-
28-
if (!this.#container) {
29-
return;
30-
}
31-
render(this.template(customStyles), this.#container);
32-
}
33-
34-
template(styles: StyleInfo) {
35-
return html`
36-
<div class="infobar" style=${styleMap(styles)}>
37-
<div class="infobar-message">${this.#message}</div>
38-
<button class="infobar-close-button" ${ref(this.#buttonRef)} @click=${this.#onClick}></button>
39-
</div>
40-
`;
41-
}
42-
43-
#onClick = () => {
44-
let styles = {
45-
display: 'none',
46-
} as StyleInfo;
47-
48-
this.#update(styles);
49-
};
50-
51-
static render(props: InfobarProps, elementId: string) {
52-
const currentContainer = document.getElementById(elementId);
53-
if (currentContainer) {
54-
new InfobarComponent(props, currentContainer);
55-
}
56-
}
57-
}
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
import { html, render } from 'lit-html';
5+
import { createRef, ref } from 'lit-html/directives/ref.js'
6+
import { styleMap, StyleInfo } from 'lit-html/directives/style-map.js';
7+
8+
interface InfobarProps {
9+
message: string;
10+
}
11+
12+
export default class InfobarComponent {
13+
#buttonRef = createRef();
14+
#message: string;
15+
#container: HTMLElement | undefined;
16+
17+
constructor(props: InfobarProps, container?: HTMLElement) {
18+
this.#message = props.message;
19+
this.#container = container;
20+
this.#update();
21+
}
22+
23+
#update(styles?: StyleInfo) {
24+
let customStyles = styles ?? {
25+
display: 'flex'
26+
};
27+
28+
if (!this.#container) {
29+
return;
30+
}
31+
render(this.template(customStyles), this.#container);
32+
}
33+
34+
template(styles: StyleInfo) {
35+
return html`
36+
<div class="infobar" style=${styleMap(styles)}>
37+
<div class="infobar-message">${this.#message}</div>
38+
<button role="button" aria-label="Close infobar" class="infobar-close-button" ${ref(this.#buttonRef)} @click=${this.#onClick}></button>
39+
</div>
40+
`;
41+
}
42+
43+
#onClick = () => {
44+
let styles = {
45+
display: 'none',
46+
} as StyleInfo;
47+
48+
this.#update(styles);
49+
};
50+
51+
static render(props: InfobarProps, elementId: string) {
52+
const currentContainer = document.getElementById(elementId);
53+
if (currentContainer) {
54+
new InfobarComponent(props, currentContainer);
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)