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

Tune aria-live regions around clocks/timers #7735

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/views/audio_messages/Clock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import React from "react";
import React, { HTMLProps } from "react";

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

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

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

public render() {
return <span className='mx_Clock'>{ formatSeconds(this.props.seconds) }</span>;
return <span aria-live={this.props["aria-live"]} className='mx_Clock'>
{ formatSeconds(this.props.seconds) }
</span>;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ export default class LiveRecordingClock extends React.PureComponent<IProps, ISta
}

public render() {
return <Clock seconds={this.state.seconds} />;
return <Clock seconds={this.state.seconds} aria-live="off" />;
}
}
5 changes: 4 additions & 1 deletion src/components/views/audio_messages/PlaybackClock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export default class PlaybackClock extends React.PureComponent<IProps, IState> {
seconds = this.state.durationSeconds;
}
}
return <Clock seconds={seconds} />;
return <Clock
seconds={seconds}
aria-live={this.state.playbackPhase === PlaybackState.Playing ? "off" : undefined}
/>;
}
}
2 changes: 1 addition & 1 deletion src/components/views/messages/CallEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
if (state === CallState.Connected) {
return (
<div className="mx_CallEvent_content">
<Clock seconds={this.state.length} />
<Clock seconds={this.state.length} aria-live="off" />
{ this.props.timestamp }
</div>
);
Expand Down