Skip to content

Commit 5f55d2a

Browse files
committed
Change display mode default from always to auto
1 parent f946d3d commit 5f55d2a

5 files changed

Lines changed: 10 additions & 15 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- Added `flyoutMenuDisplayMode` prop to `EuiFlyout` allowing consumers to hide the menu bar when it only contains a close button (`'auto'` mode).
1+
- Added `flyoutMenuDisplayMode` prop to `EuiFlyout` to control when the flyout menu renders. Defaults to `'auto'`, which hides the menu bar when it only contains a close button.

packages/eui/src/components/flyout/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const DEFAULT_SIZE: EuiFlyoutSize = 'm';
5353
export const DEFAULT_PADDING_SIZE: _EuiFlyoutPaddingSize = 'l';
5454
/** Default flyout menu display mode. */
5555
export const DEFAULT_MENU_DISPLAY_MODE: EuiFlyoutMenuDisplayMode =
56-
MENU_DISPLAY_ALWAYS;
56+
MENU_DISPLAY_AUTO;
5757

5858
/**
5959
* Custom type checker for named flyout sizes since the prop

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ interface _EuiFlyoutComponentProps {
208208

209209
/**
210210
* Controls the display mode of the flyout menu:
211+
* - `'auto'`: Render the menu whenever menu props are available and there is navigation content
212+
* (back button, history, custom actions) or a visible title.
211213
* - `'always'`: Render the menu whenever menu props are available. This may result in a close-only menu.
212-
* - `'auto'`: Render the menu whenever menu props are available and there is navigation content (back button, history, custom actions)
213-
* or a visible title.
214214
*
215-
* @default 'always'
215+
* @default 'auto'
216216
*/
217217
flyoutMenuDisplayMode?: EuiFlyoutMenuDisplayMode;
218218

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from './flyout';
2121
import { EuiProvider } from '../provider';
2222
import { EuiFlyoutManager } from './manager';
23-
import { MENU_DISPLAY_ALWAYS, MENU_DISPLAY_AUTO } from './const';
23+
import { MENU_DISPLAY_ALWAYS } from './const';
2424

2525
jest.mock('../overlay_mask', () => ({
2626
EuiOverlayMask: ({ headerZindexLocation, maskRef, ...props }: any) => (
@@ -248,7 +248,6 @@ describe('EuiFlyout', () => {
248248
},
249249
],
250250
}}
251-
flyoutMenuDisplayMode={MENU_DISPLAY_AUTO}
252251
/>
253252
);
254253

@@ -257,11 +256,7 @@ describe('EuiFlyout', () => {
257256

258257
it('renders close button when menu has no content', () => {
259258
const { getByTestSubject, queryByTestSubject } = render(
260-
<EuiFlyout
261-
onClose={() => {}}
262-
flyoutMenuProps={{}}
263-
flyoutMenuDisplayMode={MENU_DISPLAY_AUTO}
264-
/>
259+
<EuiFlyout onClose={() => {}} flyoutMenuProps={{}} />
265260
);
266261

267262
expect(getByTestSubject('euiFlyoutCloseButton')).toBeInTheDocument();

packages/website/docs/components/containers/flyout/_flyout_menu.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ In [managed session flyouts](#flyout-session-management), the Flyout Manager aut
5151

5252
#### Menu display mode
5353

54-
By default, the flyout menu is always rendered when `flyoutMenuProps` is provided. You can control this behavior with the `flyoutMenuDisplayMode` prop on `EuiFlyout`:
54+
By default, the flyout menu is rendered when `flyoutMenuProps` is provided and menu has meaningful content. You can control this behavior with the `flyoutMenuDisplayMode` prop on `EuiFlyout`:
5555

56-
- **`'always'`** (default): Always render the menu, even if it only contains a close button.
57-
- **`'auto'`**: Only render the menu when it has meaningful content (back button, history, custom actions, or a visible title). Otherwise, use a standalone close button.
56+
- **`'auto'`** (default): Only render the menu when it has navigation content (back button, history or custom actions) or a visible title. Otherwise, use a standalone close button.
57+
- **`'always'`**: Always render the menu, even if it only contains a close button.

0 commit comments

Comments
 (0)