Open new screen: Screen reader does not pass the 'Copied' information after selecting 'Copy' button.

This commit is contained in:
hardiknai-techm
2021-10-01 20:34:47 +05:30
parent f968f57543
commit 43439f65a9
2 changed files with 19 additions and 15 deletions

View File

@@ -4,6 +4,8 @@ import * as React from "react";
import { useFullScreenURLs } from "../hooks/useFullScreenURLs"; import { useFullScreenURLs } from "../hooks/useFullScreenURLs";
export const OpenFullScreen: React.FunctionComponent = () => { export const OpenFullScreen: React.FunctionComponent = () => {
const [isReadUrlCopy, setIsReadUrlCopy] = React.useState<Boolean>(false);
const [isReadWriteUrlCopy, setIsReadWriteUrlCopy] = React.useState<Boolean>(false);
const result = useFullScreenURLs(); const result = useFullScreenURLs();
if (!result) { if (!result) {
return <Spinner label="Generating URLs..." ariaLive="assertive" labelPosition="right" />; return <Spinner label="Generating URLs..." ariaLive="assertive" labelPosition="right" />;
@@ -25,8 +27,9 @@ export const OpenFullScreen: React.FunctionComponent = () => {
<DefaultButton <DefaultButton
onClick={() => { onClick={() => {
copyToClipboard(readWriteUrl); copyToClipboard(readWriteUrl);
setIsReadWriteUrlCopy(true);
}} }}
text="Copy" text={isReadWriteUrlCopy ? "Copied" : "Copy"}
iconProps={{ iconName: "Copy" }} iconProps={{ iconName: "Copy" }}
/> />
<PrimaryButton <PrimaryButton
@@ -41,9 +44,10 @@ export const OpenFullScreen: React.FunctionComponent = () => {
<Stack horizontal tokens={{ childrenGap: 10 }}> <Stack horizontal tokens={{ childrenGap: 10 }}>
<DefaultButton <DefaultButton
onClick={() => { onClick={() => {
setIsReadUrlCopy(true);
copyToClipboard(readUrl); copyToClipboard(readUrl);
}} }}
text="Copy" text={isReadUrlCopy ? "Copied" : "Copy"}
iconProps={{ iconName: "Copy" }} iconProps={{ iconName: "Copy" }}
/> />
<PrimaryButton <PrimaryButton

View File

@@ -118,7 +118,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
const saveButtonChildren = []; const saveButtonChildren = [];
if (this.container.notebookManager?.gitHubOAuthService.isLoggedIn()) { if (this.container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
saveButtonChildren.push({ saveButtonChildren.push({
iconName: "Copy", iconName: copyToLabel,
onCommandClick: () => this.copyNotebook(), onCommandClick: () => this.copyNotebook(),
commandButtonLabel: copyToLabel, commandButtonLabel: copyToLabel,
hasPopup: false, hasPopup: false,
@@ -160,7 +160,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
{ {
iconSrc: null, iconSrc: null,
iconAlt: kernelLabel, iconAlt: kernelLabel,
onCommandClick: () => {}, onCommandClick: () => { },
commandButtonLabel: null, commandButtonLabel: null,
hasPopup: false, hasPopup: false,
disabled: availableKernels.length < 1, disabled: availableKernels.length < 1,
@@ -170,16 +170,16 @@ export default class NotebookTabV2 extends NotebookTabBase {
dropdownWidth: 100, dropdownWidth: 100,
children: availableKernels.map( children: availableKernels.map(
(kernel: KernelSpecsDisplay) => (kernel: KernelSpecsDisplay) =>
({ ({
iconSrc: null, iconSrc: null,
iconAlt: kernel.displayName, iconAlt: kernel.displayName,
onCommandClick: () => this.notebookComponentAdapter.notebookChangeKernel(kernel.name), onCommandClick: () => this.notebookComponentAdapter.notebookChangeKernel(kernel.name),
commandButtonLabel: kernel.displayName, commandButtonLabel: kernel.displayName,
dropdownItemKey: kernel.name, dropdownItemKey: kernel.name,
hasPopup: false, hasPopup: false,
disabled: false, disabled: false,
ariaLabel: kernel.displayName, ariaLabel: kernel.displayName,
} as CommandButtonComponentProps) } as CommandButtonComponentProps)
), ),
ariaLabel: kernelLabel, ariaLabel: kernelLabel,
}, },
@@ -271,7 +271,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
{ {
iconSrc: null, iconSrc: null,
iconAlt: null, iconAlt: null,
onCommandClick: () => {}, onCommandClick: () => { },
commandButtonLabel: null, commandButtonLabel: null,
ariaLabel: cellTypeLabel, ariaLabel: cellTypeLabel,
hasPopup: false, hasPopup: false,