mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-20 08:37:59 +01:00
Fix a11y new collection throughput radiobutton issue
This commit is contained in:
parent
2d945c8231
commit
8ebd0f9b01
@ -1,4 +1,15 @@
|
|||||||
import { Checkbox, DirectionalHint, Link, Stack, Text, TextField, TooltipHost } from "@fluentui/react";
|
import {
|
||||||
|
Checkbox,
|
||||||
|
ChoiceGroup,
|
||||||
|
DirectionalHint,
|
||||||
|
IChoiceGroupOption,
|
||||||
|
Label,
|
||||||
|
Link,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
TextField,
|
||||||
|
TooltipHost,
|
||||||
|
} from "@fluentui/react";
|
||||||
import React, { FunctionComponent, useState } from "react";
|
import React, { FunctionComponent, useState } from "react";
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip";
|
import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip";
|
||||||
@ -90,7 +101,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnChangeMode = (event: React.ChangeEvent<HTMLInputElement>, mode: string): void => {
|
const handleOnChangeMode = (_: React.ChangeEvent<HTMLInputElement>, mode: string): void => {
|
||||||
if (mode === "Autoscale") {
|
if (mode === "Autoscale") {
|
||||||
setThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
setThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
setIsAutoScaleSelected(true);
|
setIsAutoScaleSelected(true);
|
||||||
@ -103,39 +114,46 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
setIsAutoscale(false);
|
setIsAutoscale(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const choiceButtonStyles = {
|
||||||
|
flexContainer: [
|
||||||
|
{
|
||||||
|
selectors: {
|
||||||
|
".ms-ChoiceField-wrapper label": {
|
||||||
|
fontSize: 12,
|
||||||
|
paddingTop: 0,
|
||||||
|
},
|
||||||
|
".ms-ChoiceField": {
|
||||||
|
marginTop: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const throughPutOptions: IChoiceGroupOption[] = [
|
||||||
|
{ key: "Autoscale", text: "Autoscale" },
|
||||||
|
{ key: "Manual", text: "Manual" },
|
||||||
|
];
|
||||||
return (
|
return (
|
||||||
<div className="throughputInputContainer throughputInputSpacing">
|
<div className="throughputInputContainer throughputInputSpacing">
|
||||||
<Stack horizontal>
|
<Stack horizontal>
|
||||||
<span className="mandatoryStar">* </span>
|
<span className="mandatoryStar">* </span>
|
||||||
<Text aria-label="Throughput header" variant="small" style={{ lineHeight: "20px", fontWeight: 600 }}>
|
<Label id="throughPut" aria-label={getThroughputLabelText()} style={{ lineHeight: "20px", fontWeight: 600 }}>
|
||||||
{getThroughputLabelText()}
|
{getThroughputLabelText()}
|
||||||
</Text>
|
</Label>
|
||||||
<InfoTooltip>{PricingUtils.getRuToolTipText()}</InfoTooltip>
|
<InfoTooltip>{PricingUtils.getRuToolTipText()}</InfoTooltip>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Stack horizontal verticalAlign="center">
|
<Stack verticalAlign="center">
|
||||||
<input
|
<ChoiceGroup
|
||||||
className="throughputInputRadioBtn"
|
ariaLabelledBy="throughPut"
|
||||||
aria-label="Autoscale mode"
|
styles={choiceButtonStyles}
|
||||||
checked={isAutoscaleSelected}
|
options={throughPutOptions}
|
||||||
type="radio"
|
defaultSelectedKey={throughPutOptions[0].key}
|
||||||
role="radio"
|
onChange={(_: React.ChangeEvent<HTMLInputElement>, options: IChoiceGroupOption) =>
|
||||||
tabIndex={0}
|
handleOnChangeMode(_, options.key.toString())
|
||||||
onChange={(e) => handleOnChangeMode(e, "Autoscale")}
|
}
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
<span className="throughputInputRadioBtnLabel">Autoscale</span>
|
|
||||||
|
|
||||||
<input
|
|
||||||
className="throughputInputRadioBtn"
|
|
||||||
aria-label="Manual mode"
|
|
||||||
checked={!isAutoscaleSelected}
|
|
||||||
type="radio"
|
|
||||||
role="radio"
|
|
||||||
tabIndex={0}
|
|
||||||
onChange={(e) => handleOnChangeMode(e, "Manual")}
|
|
||||||
/>
|
|
||||||
<span className="throughputInputRadioBtnLabel">Manual</span>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{isAutoscaleSelected && (
|
{isAutoscaleSelected && (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user