Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 773c7f4

Browse files
authored
Tune aria-live regions around clocks/timers (#7735)
1 parent 4501308 commit 773c7f4

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/components/views/audio_messages/Clock.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import React from "react";
17+
import React, { HTMLProps } from "react";
1818

1919
import { formatSeconds } from "../../../DateUtils";
2020
import { replaceableComponent } from "../../../utils/replaceableComponent";
2121

22-
export interface IProps {
22+
export interface IProps extends Pick<HTMLProps<HTMLSpanElement>, "aria-live"> {
2323
seconds: number;
2424
}
2525

@@ -40,6 +40,8 @@ export default class Clock extends React.Component<IProps> {
4040
}
4141

4242
public render() {
43-
return <span className='mx_Clock'>{ formatSeconds(this.props.seconds) }</span>;
43+
return <span aria-live={this.props["aria-live"]} className='mx_Clock'>
44+
{ formatSeconds(this.props.seconds) }
45+
</span>;
4446
}
4547
}

src/components/views/audio_messages/LiveRecordingClock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ export default class LiveRecordingClock extends React.PureComponent<IProps, ISta
6161
}
6262

6363
public render() {
64-
return <Clock seconds={this.state.seconds} />;
64+
return <Clock seconds={this.state.seconds} aria-live="off" />;
6565
}
6666
}

src/components/views/audio_messages/PlaybackClock.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export default class PlaybackClock extends React.PureComponent<IProps, IState> {
7676
seconds = this.state.durationSeconds;
7777
}
7878
}
79-
return <Clock seconds={seconds} />;
79+
return <Clock
80+
seconds={seconds}
81+
aria-live={this.state.playbackPhase === PlaybackState.Playing ? "off" : undefined}
82+
/>;
8083
}
8184
}

src/components/views/messages/CallEvent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
227227
if (state === CallState.Connected) {
228228
return (
229229
<div className="mx_CallEvent_content">
230-
<Clock seconds={this.state.length} />
230+
<Clock seconds={this.state.length} aria-live="off" />
231231
{ this.props.timestamp }
232232
</div>
233233
);

0 commit comments

Comments
 (0)