Skip to content

Commit 68c5edd

Browse files
committed
Update docs
1 parent cf2e16b commit 68c5edd

File tree

2 files changed

+53
-25
lines changed

2 files changed

+53
-25
lines changed

packages/eui/src/components/flyout/flyout_menu.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface EuiFlyoutHistoryItem {
4747
}
4848

4949
/**
50-
* Custom action item for the flyout menu header
50+
* Custom action item for the flyout menu component
5151
*/
5252
export interface EuiFlyoutMenuCustomAction {
5353
/**
@@ -75,32 +75,29 @@ export type EuiFlyoutMenuProps = CommonProps &
7575
* ```jsx
7676
* <EuiFlyout
7777
* aria-labelledby="myMenuTitleId"
78+
* flyoutMenuProps={{ title: 'Menu title', titleId: 'myMenuTitleId' }
7879
* >
79-
* <EuiFlyoutMenu
80-
* titleId="myMenuTitleId"
81-
* title="Menu title"
82-
* />
80+
* ...
8381
* </EuiFlyout>
8482
* ```
8583
*/
8684
titleId?: string;
8785
/**
88-
* Title for the menu header
86+
* Title for the menu component. In a managed flyout context, the title is used to indicate the flyout session for history navigation.
8987
*/
9088
title?: React.ReactNode;
9189
/**
92-
* Hides the title in the flyout menu bar.
93-
* If the flyout is used in a managed flyout session as a "main" flyout, the default will be true, as main flyouts typically show a title in an EuiFlyoutHeader instead.
94-
* @default true for main flyout in managed flyout session; false otherwise
90+
* Hides the title in the `EuiFlyoutMenu`. This is useful when the title is already shown in an `EuiFlyoutHeader`.
91+
* @default true for main flyout in a managed flyout session; false otherwise
9592
*/
9693
hideTitle?: boolean;
9794
/**
98-
* Hides the close button in the menu header
95+
* Hides the close button in the menu component
9996
* @default false
10097
*/
10198
hideCloseButton?: boolean;
10299
/**
103-
* Shows a back button in the menu header
100+
* Shows a back button in the menu component
104101
* @default false
105102
*/
106103
showBackButton?: boolean;
@@ -113,7 +110,7 @@ export type EuiFlyoutMenuProps = CommonProps &
113110
*/
114111
historyItems?: EuiFlyoutHistoryItem[];
115112
/**
116-
* List of custom action items for the menu header
113+
* List of custom action items for the menu component
117114
*/
118115
customActions?: EuiFlyoutMenuCustomAction[];
119116
};

packages/website/docs/components/containers/flyout/session-management.mdx

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,17 @@ export default () => {
3939
<EuiFlyout
4040
session="start"
4141
size="s"
42-
aria-label="Flyout A - main"
43-
flyoutMenuProps={{
44-
title: 'Welcome to the flyout session management journey!',
45-
}}
42+
aria-labelledby="welcomeHeading"
43+
flyoutMenuProps={{ title: 'Welcome' }}
4644
onClose={() => setIsOpenFlyoutA(false)}
4745
>
46+
<EuiFlyoutHeader>
47+
<EuiTitle>
48+
<h2 id="welcomeHeading">
49+
Welcome to the flyout session management journey!
50+
</h2>
51+
</EuiTitle>
52+
</EuiFlyoutHeader>
4853
<EuiFlyoutBody>
4954
<EuiText>This flyout is rendered with the <EuiCode>{'session="start"'}</EuiCode> prop set which creates a new flyout session and marks this flyout as main.</EuiText>
5055
<EuiSpacer />
@@ -60,12 +65,17 @@ export default () => {
6065
<EuiFlyout
6166
session="start"
6267
size="m"
63-
aria-label="Flyout B - main"
64-
flyoutMenuProps={{
65-
title: <>Glad to meet you, {name || 'stranger'}!</>,
66-
}}
68+
aria-labelledby="flyoutBHeading"
69+
flyoutMenuProps={{ title: 'Flyout B' }}
6770
onClose={() => setIsOpenFlyoutB(false)}
6871
>
72+
<EuiFlyoutHeader>
73+
<EuiTitle>
74+
<h2 id="flyoutBHeading">
75+
Glad to meet you, {name || 'stranger'}!
76+
</h2>
77+
</EuiTitle>
78+
</EuiFlyoutHeader>
6979
<EuiFlyoutBody>
7080
<EuiText>
7181
This flyout is also rendered with the <EuiCode>{'session="start"'}</EuiCode> prop added which creates a <strong>second flyout session</strong> and marks this flyout as main in that session.
@@ -119,9 +129,19 @@ All bindings and configuration will be handled automatically.
119129

120130
### Session title
121131

122-
Flyout sessions within the managed system require a title that can be
123-
referenced in the history navigation features. Use the `title`
124-
field of the `flyoutMenuProps` to set the title of the flyout.
132+
Managed flyout sessions require a title that can be referenced in the history
133+
navigation features. Use the `title` field of the `flyoutMenuProps` to set the
134+
title of the flyout session. If `flyoutMenuProps` is omitted or a `title` field
135+
is not given in `flyoutMenuProps`, the manager will use the `aria-label`
136+
attribute of `EuiFlyout` as the source for the session's title. If no source
137+
for a title is given, a default title will be provided.
138+
139+
:::info Note
140+
The "main" flyout in a session should use `EuiFlyoutHeader` for the actual
141+
flyout heading. For this reason, the `title` given from `flyoutMenuProps` will
142+
not be visible to end users. However, a title is still needed for the history
143+
navigation feature of the flyout session management system.
144+
:::
125145

126146
```tsx
127147
{/* Render a new main flyout and create a flyout session */}
@@ -130,17 +150,28 @@ field of the `flyoutMenuProps` to set the title of the flyout.
130150
flyoutMenuProps={{
131151
title: 'My main flyout'
132152
}}
153+
aria-labelledby="myFlyoutHeading"
133154
>
155+
<EuiFlyoutHeader>
156+
<EuiTitle>
157+
<h2 id="myFlyoutHeading">
158+
I'm the main flyout heading
159+
</h2>
160+
</EuiTitle>
161+
</EuiFlyoutHeader>
134162
<EuiFlyoutBody>
135-
I'm the main flyout
163+
I'm the main flyout body
136164
</EuiFlyoutBody>
137165
{/* Render a new child flyout - notice the lack of the `session` prop */}
138166
<EuiFlyout
139167
flyoutMenuProps={{
140168
title: 'My child flyout'
141169
}}
142170
>
143-
I'm the child flyout that belongs to the same session as the main flyout
171+
{/* Render a child flyout contents. Notice the lack of the EuiFlyoutHeader component - the child flyout menu shows the title from flyoutMenuProps */}
172+
<EuiFlyoutBody>
173+
I'm the child flyout that belongs to the same session as the main flyout
174+
</EuiFlyoutBody>
144175
</EuiFlyout>
145176
</EuiFlyout>
146177
```

0 commit comments

Comments
 (0)