From 60aa477648366239b357d7099ddf8fffcba02cf1 Mon Sep 17 00:00:00 2001 From: liweitian Date: Sat, 18 Apr 2020 02:59:16 +0800 Subject: [PATCH] fix accessibility issue on create new bot dialog (#2683) Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com> --- .../src/CreationFlow/CreateOptions/index.js | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Composer/packages/client/src/CreationFlow/CreateOptions/index.js b/Composer/packages/client/src/CreationFlow/CreateOptions/index.js index 234b8f67ab..a3e5d704f8 100644 --- a/Composer/packages/client/src/CreationFlow/CreateOptions/index.js +++ b/Composer/packages/client/src/CreationFlow/CreateOptions/index.js @@ -22,8 +22,13 @@ import { Sticky, StickyPositionType } from 'office-ui-fabric-react/lib/Sticky'; import { detailListContainer, listHeader, rowDetails, rowTitle, optionRoot, optionIcon } from './styles'; +const optionKeys = { + createFromScratch: 'createFromScratch', + createFromTemplate: 'createFromTemplate', +}; + export function CreateOptions(props) { - const [option, setOption] = useState('CreateFromScratch'); + const [option, setOption] = useState(optionKeys.createFromScratch); const [disabled, setDisabled] = useState(true); const { templates, onDismiss, onNext } = props; const emptyBotKey = templates[1].id; @@ -49,7 +54,7 @@ export function CreateOptions(props) { const handleChange = (event, option) => { setOption(option.key); - if (option.key === 'CreateFromTemplate') { + if (option.key === optionKeys.createFromTemplate) { setDisabled(false); } else { setDisabled(true); @@ -57,7 +62,7 @@ export function CreateOptions(props) { }; const handleJumpToNext = () => { - if (option === 'CreateFromTemplate') { + if (option === optionKeys.createFromTemplate) { onNext(template); } else { onNext(emptyBotKey); @@ -110,25 +115,24 @@ export function CreateOptions(props) {

{formatMessage('Examples')}

@@ -151,7 +155,7 @@ export function CreateOptions(props) {