diff --git a/apps/public-docsite-v9/.storybook/manager-head.html b/apps/public-docsite-v9/.storybook/manager-head.html index 166e67ed6e6e7..f831e114550a3 100644 --- a/apps/public-docsite-v9/.storybook/manager-head.html +++ b/apps/public-docsite-v9/.storybook/manager-head.html @@ -148,7 +148,7 @@ Usign suggested temporary workaround until storybook gets proper support See https://github.com/microsoft/fluentui/blob/master/rfcs/convergence/authoring-stories.md#10-internal-stories-for-testing */ - [id*='accessibility-scenario'] { + [id*='accessibility-stories'] { display: none !important; } diff --git a/change/@fluentui-react-components-ee7b5914-40cd-4950-b46d-d75c94ad4037.json b/change/@fluentui-react-components-ee7b5914-40cd-4950-b46d-d75c94ad4037.json new file mode 100644 index 0000000000000..19e1c9cad68d6 --- /dev/null +++ b/change/@fluentui-react-components-ee7b5914-40cd-4950-b46d-d75c94ad4037.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Add uncomplete Input scenario", + "packageName": "@fluentui/react-components", + "email": "adam.samec@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-components/.storybook/manager-head.html b/packages/react-components/react-components/.storybook/manager-head.html index e651c93463947..7197bdcba97cd 100644 --- a/packages/react-components/react-components/.storybook/manager-head.html +++ b/packages/react-components/react-components/.storybook/manager-head.html @@ -115,7 +115,7 @@ Usign suggested temporary workaround until storybook gets proper support See https://github.com/microsoft/fluentui/blob/master/rfcs/convergence/authoring-stories.md#10-internal-stories-for-testing */ - [id*='accessibility-scenario'] { + [id*='accessibility-stories'] { display: none !important; } diff --git a/packages/react-components/react-components/src/AccessibilityScenarios/Accordion.stories.tsx b/packages/react-components/react-components/src/AccessibilityScenarios/Accordion.stories.tsx index 912310877d17d..80ef90767eec4 100644 --- a/packages/react-components/react-components/src/AccessibilityScenarios/Accordion.stories.tsx +++ b/packages/react-components/react-components/src/AccessibilityScenarios/Accordion.stories.tsx @@ -8,68 +8,79 @@ import { Button, Input, Label, + Radio, + RadioGroup, + Checkbox, } from '@fluentui/react-components'; import { Scenario } from './utils'; -export const PersonalFormAccordionAccessibilityScenario: React.FunctionComponent = () => { +export const PersonalFormAccordion = () => { + const [isSubmitted, setIsSubmitted] = React.useState(false); + + React.useEffect(() => { + if (isSubmitted) { + document.getElementById('formSubmittedText')?.focus(); + } + }, [isSubmitted]); + + const onSubmit = (event: React.BaseSyntheticEvent) => { + event.preventDefault(); + setIsSubmitted(true); + }; + return (

Personal form

-
- - - Basic information - - - - - -
- Age - - - - - - -
-
-
- - Residence - - - - - - - - - - - Hobbies - -
- - - - - - - - -
-
-
-
- -
+ {!isSubmitted ? ( +
+ + + Basic information + + + + + + + + + + + + + + + Residence + + + + + + + + + + + Hobbies + +
+ + + + + +
+
+
+
+ +
+ ) : ( +

+ The form would have been submitted. +

+ )}
); }; - -export default { - title: 'Accessibility Scenarios / Personal form accordion', - id: 'accordion-accessibility-scenario', -}; diff --git a/packages/react-components/react-components/src/AccessibilityScenarios/AccordionFaq.stories.tsx b/packages/react-components/react-components/src/AccessibilityScenarios/AccordionFaq.stories.tsx index 4c1852f5f442f..5465b30064719 100644 --- a/packages/react-components/react-components/src/AccessibilityScenarios/AccordionFaq.stories.tsx +++ b/packages/react-components/react-components/src/AccessibilityScenarios/AccordionFaq.stories.tsx @@ -4,7 +4,7 @@ import { Accordion, AccordionHeader, AccordionItem, AccordionPanel } from '@flue import { Scenario } from './utils'; -export const FAQAccordionAccessibilityScenario: React.FunctionComponent = () => { +export const FAQAccordion: React.FunctionComponent = () => { return (

Frequently asked questions about Windows

@@ -53,8 +53,3 @@ export const FAQAccordionAccessibilityScenario: React.FunctionComponent = () =>
); }; - -export default { - title: 'Accessibility Scenarios / FAQ accordion', - id: 'accordion-faq-accessibility-scenario', -}; diff --git a/packages/react-components/react-components/src/AccessibilityScenarios/Button.stories.tsx b/packages/react-components/react-components/src/AccessibilityScenarios/Button.stories.tsx index b352a42397110..e0edc38debd7f 100644 --- a/packages/react-components/react-components/src/AccessibilityScenarios/Button.stories.tsx +++ b/packages/react-components/react-components/src/AccessibilityScenarios/Button.stories.tsx @@ -4,8 +4,7 @@ import { Button } from '@fluentui/react-components'; import { Scenario } from './utils'; -export const MessengerButtonsAccessibilityScenario: React.FunctionComponent = () => { - const [sendButtonDisabled, setSendButtonDisabled] = React.useState(true); +export const MessengerButtons: React.FunctionComponent = () => { const [deleteButtonDisabled, setDeleteButtonDisabled] = React.useState(true); const [increaseFontButtonDisabled, setIncreaseFontButtonDisabled] = React.useState(undefined); const [decreaseFontButtonDisabled, setDecreaseFontButtonDisabled] = React.useState(true); @@ -23,13 +22,16 @@ export const MessengerButtonsAccessibilityScenario: React.FunctionComponent = () const resetMessage = () => { setMessage(''); - setSendButtonDisabled(true); setDeleteButtonDisabled(true); }; const onSendButtonClick = () => { + if (message.length > 0) { + setStatusText('Message has been sent.'); + } else { + setStatusText('Please type a message.'); + } resetMessage(); - setStatusText('Message has been sent.'); }; const onDeleteButtonClick = () => { resetMessage(); @@ -59,11 +61,9 @@ export const MessengerButtonsAccessibilityScenario: React.FunctionComponent = () const onMessageTextareaChange = (event: React.ChangeEvent) => { const value = event.target.value; if (value.length > 0) { - setSendButtonDisabled(undefined); setDeleteButtonDisabled(undefined); setStatusText(''); } else { - setSendButtonDisabled(true); setDeleteButtonDisabled(true); } setMessage(value); @@ -71,38 +71,28 @@ export const MessengerButtonsAccessibilityScenario: React.FunctionComponent = () return ( - - -
-