diff --git a/change/@fluentui-react-card-8ef7aceb-3860-4d43-aa98-9b830ff4c003.json b/change/@fluentui-react-card-8ef7aceb-3860-4d43-aa98-9b830ff4c003.json
new file mode 100644
index 0000000000000..510e92113f22d
--- /dev/null
+++ b/change/@fluentui-react-card-8ef7aceb-3860-4d43-aa98-9b830ff4c003.json
@@ -0,0 +1,7 @@
+{
+ "type": "prerelease",
+ "comment": "Added new `focusMode` property to control the focus behavior inside of the component",
+ "packageName": "@fluentui/react-card",
+ "email": "39736248+andrefcdias@users.noreply.github.com",
+ "dependentChangeType": "patch"
+}
diff --git a/packages/react-components/react-card/Spec.md b/packages/react-components/react-card/Spec.md
index bc09340ce3cec..52fdf4e3a37b2 100644
--- a/packages/react-components/react-card/Spec.md
+++ b/packages/react-components/react-card/Spec.md
@@ -102,17 +102,17 @@ Card goes for a more structural and generic approach to a card component and is
#### API
-| Property | Values | Default | Purpose |
-| ----------- | ------------------------------------------------------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------- |
-| orientation | `vertical`, `horizontal` | `vertical` | Orientation of the card |
-| size | `smallest`, `smaller`, `small`, `medium`, `large` | `medium` | Define the minimum size of the card. Smaller sizes only apply to horizontal card |
-| scale | `fixed`, `auto-width`, `auto-height`, `auto`, `fluid-width`, `fluid-height`, `fluid` | `auto` | Manages how the card handles it's scaling depending on the content |
-| appearance | `filled`, `filled-alternative`, `outline`, `subtle` | `filled` | Define the appearance of the card |
-| selectable | boolean | false | Makes the card selectable by adding a checkbox to the _Actions_ area |
-| selected | boolean | false | Set to `true` if card is selected |
-| expandable | boolean | false | Allow card to expand to show whole content |
-| disabled | boolean | false | Makes the card and card selection disabled (not propagated to children) |
-| focusable | boolean \| 'noTab' \| 'tabExit' \| 'tabOnly' | false | Sets the focus behavior for the card. If `true`, the card will have the 'noTab' focus behavior. |
+| Property | Values | Default | Purpose |
+| ----------- | ------------------------------------------------------------------------------------ | ---------- | -------------------------------------------------------------------------------- |
+| orientation | `vertical`, `horizontal` | `vertical` | Orientation of the card |
+| size | `smallest`, `smaller`, `small`, `medium`, `large` | `medium` | Define the minimum size of the card. Smaller sizes only apply to horizontal card |
+| scale | `fixed`, `auto-width`, `auto-height`, `auto`, `fluid-width`, `fluid-height`, `fluid` | `auto` | Manages how the card handles it's scaling depending on the content |
+| appearance | `filled`, `filled-alternative`, `outline`, `subtle` | `filled` | Define the appearance of the card |
+| selectable | boolean | false | Makes the card selectable by adding a checkbox to the _Actions_ area |
+| selected | boolean | false | Set to `true` if card is selected |
+| expandable | boolean | false | Allow card to expand to show whole content |
+| disabled | boolean | false | Makes the card and card selection disabled (not propagated to children) |
+| focusMode | `off`, `no-tab`, `tab-exit`, `tab-only` | `off` | Sets the focus behavior for the card. |
#### `scale` property
@@ -124,19 +124,23 @@ Card goes for a more structural and generic approach to a card component and is
- `fluid-height`: `height` is set to `100%`.
- `fluid`: `width` and `height` are set to `100%`.
-#### `focusable` property
+#### `focusMode` property
-The three allowed focus behaviours (noTab, tabExit, tabOnly) map to the behaviors provided by Tabster.
+The three allowed focus behaviours (`no-tab`, `tab-exit`, `tab-only`) map to the behaviors provided by Tabster.
-- `noTab` (`trapFocus` in Tabster)
+- `off`
+
+ The card will not focusable.
+
+- `no-tab` (`trapFocus` in Tabster)
This behaviour traps the focus inside of the Card when pressing the `Enter` key and will only release focus when pressing the `Escape` key.
-- `tabExit` (`limited` in Tabster)
+- `tab-exit` (`limited` in Tabster)
This behaviour traps the focus inside of the Card when pressing the `Enter` key but will release focus when pressing the `Tab` key on the last inner element.
-- `tabOnly` (`unlimited` in Tabster)
+- `tab-only` (`unlimited` in Tabster)
This behaviour will cycle through all elements inside of the Card when pressing the `Tab` key and then release focus after the last inner element.
diff --git a/packages/react-components/react-card/e2e/Card.e2e.tsx b/packages/react-components/react-card/e2e/Card.e2e.tsx
new file mode 100644
index 0000000000000..66c7bfa324e0d
--- /dev/null
+++ b/packages/react-components/react-card/e2e/Card.e2e.tsx
@@ -0,0 +1,243 @@
+import * as React from 'react';
+import { mount } from '@cypress/react';
+import type {} from '@cypress/react';
+import { FluentProvider } from '@fluentui/react-provider';
+import { webLightTheme } from '@fluentui/react-theme';
+import { Button } from '@fluentui/react-button';
+import { Card, CardFooter, CardHeader } from '@fluentui/react-card';
+import type { CardProps } from '@fluentui/react-card';
+
+const mountFluent = (element: JSX.Element) => {
+ mount({element});
+};
+
+const CardSample = (props: CardProps) => {
+ const ASSET_URL = 'https://raw.githubusercontent.com/microsoft/fluentui/master/packages/react-card';
+
+ const powerpointLogoURL = ASSET_URL + '/assets/powerpoint_logo.svg';
+
+ return (
+ <>
+
+ 'off' (Default)
+
+ The contents might still be focusable, but the Card won't manage the focus of its contents or be focusable.
+
+
+
+
+ 'no-tab'
+
+ The Card will be focusable and trap the focus. You can use Tab to navigate between the contents and escaping
+ focus only by pressing the Esc key.
+
+
+
+
+ 'tab-exit'
+ The Card will be focusable and trap the focus, but release it on an Esc or Tab key press.
+
+
+
+ 'tab-only'
+
+ The Card will not trap focus but will still be focusable and allow Tab navigation of its contents.
+
+
+
+
+ );
+};
+
+FocusMode.parameters = {
+ docs: {
+ description: {
+ story:
+ 'Cards can be focusable and manage the focus of their contents in several different strategies. ' +
+ 'Using the `focusMode` prop, we can achieve the following:',
+ },
+ },
+};
diff --git a/packages/react-components/react-card/tsconfig.json b/packages/react-components/react-card/tsconfig.json
index 1941a041d46c1..9087bac77cc8d 100644
--- a/packages/react-components/react-card/tsconfig.json
+++ b/packages/react-components/react-card/tsconfig.json
@@ -20,6 +20,9 @@
},
{
"path": "./.storybook/tsconfig.json"
+ },
+ {
+ "path": "./e2e/tsconfig.json"
}
]
}