Repository: microsoft/fluent-ui-react (ts)

Issue:
AlertBehavior does not add aria-describedby to the dismiss action
## Bug Report

### Steps
open https://microsoft.github.io/fluent-ui-react/components/alert/definition#types-dismissible
check if dismiss action has aria-describedby

### Expected Result
aria-describedby points to the body of the alert

### Actual Result
aria-describedby is missing

### Version
0.42.0

### Testcase
https://microsoft.github.io/fluent-ui-react/components/alert/definition#types-dismissible

Pull request:
fix(AlertBehavior) add missing aria-describedby to AlertBehavior when…
This PR fixes issue with lack of `aria-describedby `in `AlertBehavior `when dismiss action is defined and type is different than warning/danger

Fixes #2197

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6d3a2eb6..a720508ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
 
 ### Fixes
 - Remove dependency on Lodash in TypeScript typings @layershifter ([#2323](https://github.com/microsoft/fluent-ui-react/pull/2323))
+- Fix missing aria-describedby in AlertBehavior @delprzemo ([#2208](https://github.com/microsoft/fluent-ui-react/pull/2208))
 
 <!--------------------------------[ v0.44.0 ]------------------------------- -->
 ## [v0.44.0](https://github.com/microsoft/fluent-ui-react/tree/v0.44.0) (2020-02-05)
diff --git a/packages/accessibility/src/behaviors/Alert/alertBaseBehavior.ts b/packages/accessibility/src/behaviors/Alert/alertBaseBehavior.ts
new file mode 100644
index 000000000..625e55c10
--- /dev/null
+++ b/packages/accessibility/src/behaviors/Alert/alertBaseBehavior.ts
@@ -0,0 +1,17 @@
+import { Accessibility } from '../../types'
+import { AlertProps } from './alertWarningBehavior'
+
+/**
+ * @description
+ * Use attribute 'aria-describedby' for dismiss action.
+ */
+
+const alertBaseBehavior: Accessibility<AlertProps> = props => ({
+  attributes: {
+    dismissAction: {
+      'aria-describedby': props.bodyId,
+    },
+  },
+})
+
+export default alertBaseBehavior
diff --git a/packages/accessibility/src/behaviors/Alert/alertBehavior.ts b/packages/accessibility/src/behaviors/Alert/alertBehavior.ts
index 23a589ebd..51c9a80ca 100644
--- a/packages/accessibility/src/behaviors/Alert/alertBehavior.ts
+++ b/packages/accessibility/src/behaviors/Alert/alertBehavior.ts
@@ -1,11 +1,12 @@
 import { Accessibility } from '../../types'
 import alertWarningBehavior, { AlertProps } from './alertWarningBehavior'
+import alertBaseBehavior from './alertBaseBehavior'
 
 /**
  * @description
  * Uses `alertWarningBehavior` for 'danger' and 'warning' variants.
  */
 const alertBehavior: Accessibility<AlertProps> = props =>
-  props.warning || props.danger ? alertWarningBehavior(props) : {}
+  props.warning || props.danger ? alertWarningBehavior(props) : alertBaseBehavior(props)
 
 export default alertBehavior
diff --git a/packages/accessibility/src/behaviors/index.ts b/packages/accessibility/src/behaviors/index.ts
index f122ecae6..bf12af08a 100644
--- a/packages/accessibility/src/behaviors/index.ts
+++ b/packages/accessibility/src/behaviors/index.ts
@@ -1,5 +1,6 @@
 export { default as alertBehavior } from './Alert/alertBehavior'
 export { default as alertWarningBehavior } from './Alert/alertWarningBehavior'
+export { default as alertBaseBehavior } from './Alert/alertBaseBehavior'
 export { default as attachmentBehavior } from './Attachment/attachmentBehavior'
 export { default as buttonBehavior } from './Button/buttonBehavior'
 export { default as toggleButtonBehavior } from './Button/toggleButtonBehavior'


Test patch:
diff --git a/packages/accessibility/test/behaviors/alertBehavior-test.tsx b/packages/accessibility/test/behaviors/alertBehavior-test.tsx
index d4c581209..b969b916f 100644
--- a/packages/accessibility/test/behaviors/alertBehavior-test.tsx
+++ b/packages/accessibility/test/behaviors/alertBehavior-test.tsx
@@ -10,4 +10,14 @@ describe('AlertBehavior.ts', () => {
     const expectedResult = alertBehavior({ danger: true })
     expect(expectedResult.attributes.body.role).toEqual('alert')
   })
+
+  test('use aria-describedby if dismiss action is defined for non-warning alert', () => {
+    const expectedResult = alertBehavior({ bodyId: 'alertId' })
+    expect(expectedResult.attributes.dismissAction['aria-describedby']).toEqual('alertId')
+  })
+
+  test('use aria-describedby if dismiss action is defined for warning alert', () => {
+    const expectedResult = alertBehavior({ warning: true, bodyId: 'alertId' })
+    expect(expectedResult.attributes.dismissAction['aria-describedby']).toEqual('alertId')
+  })
 })
diff --git a/packages/accessibility/test/behaviors/behavior-test.tsx b/packages/accessibility/test/behaviors/behavior-test.tsx
index 32125a553..22a81766d 100644
--- a/packages/accessibility/test/behaviors/behavior-test.tsx
+++ b/packages/accessibility/test/behaviors/behavior-test.tsx
@@ -41,6 +41,7 @@ import {
   gridHorizontalBehavior,
   statusBehavior,
   alertWarningBehavior,
+  alertBaseBehavior,
   accordionBehavior,
   accordionTitleBehavior,
   accordionContentBehavior,
@@ -125,6 +126,7 @@ testHelper.addBehavior('gridHorizontalBehavior', gridHorizontalBehavior)
 testHelper.addBehavior('dialogBehavior', dialogBehavior)
 testHelper.addBehavior('statusBehavior', statusBehavior)
 testHelper.addBehavior('alertWarningBehavior', alertWarningBehavior)
+testHelper.addBehavior('alertBaseBehavior', alertBaseBehavior)
 testHelper.addBehavior('accordionBehavior', accordionBehavior)
 testHelper.addBehavior('accordionTitleBehavior', accordionTitleBehavior)
 testHelper.addBehavior('accordionContentBehavior', accordionContentBehavior)
diff --git a/packages/accessibility/test/behaviors/testHelper.tsx b/packages/accessibility/test/behaviors/testHelper.tsx
index 267fc35bb..13bfad344 100644
--- a/packages/accessibility/test/behaviors/testHelper.tsx
+++ b/packages/accessibility/test/behaviors/testHelper.tsx
@@ -21,6 +21,7 @@ const skipSpecChecksForFiles = [
   'listBehavior.ts', // tests are written in listBehavior-test.tsx
   'listItemBehavior.ts', // tests are written in listItemBehavior-test.tsx
   'alertBehavior.ts', // tests are written in alertBehavior-test.tsx
+  'alertBaseBehavior.ts', // tests are written in alertBaseBehavior-test.tsx
   'sliderBehavior.ts', // tests are written in sliderBehavior-test.ts
   'treeItemAsListItemBehavior.ts', // tests are written in treeItemAsListItemBehavior-test.ts
   'treeTitleAsListItemTitleBehavior.ts', // tests are written in treeTitleAsListItemTitleBehavior-test.ts