Skip to content

Commit 1585f83

Browse files
chore(dropdown-like components): updated isFlipEnabled to true by def… (#8215)
* chore(dropdown-like components): updated isFlipEnabled to true by default * Updated snapshots * Updated failing integration test * Updated conditional for adding static class * Updated static logic based on Core updates * Updated ContextSelector
1 parent ee9b15c commit 1585f83

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

packages/react-core/src/components/ContextSelector/ContextSelector.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
9595
footer: null as React.ReactNode,
9696
isPlain: false,
9797
isText: false,
98-
isFlipEnabled: false,
98+
isFlipEnabled: true,
9999
removeFindDomNode: false
100100
};
101101
constructor(props: ContextSelectorProps) {
@@ -145,15 +145,10 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
145145
const uniqueId = id || getUniqueId();
146146
const toggleId = `pf-context-selector-toggle-id-${uniqueId}`;
147147
const screenReaderLabelId = `pf-context-selector-label-id-${uniqueId}`;
148+
const isStatic = isFlipEnabled && menuAppendTo !== 'inline';
148149

149150
const menuContainer = (
150-
<div
151-
className={css(styles.contextSelectorMenu)}
152-
// This removes the `position: absolute`styling from the `.pf-c-context-selector__menu`
153-
// allowing the menu to flip correctly
154-
{...(isFlipEnabled && { style: { position: 'revert' } })}
155-
id={uniqueId}
156-
>
151+
<div className={css(styles.contextSelectorMenu, isStatic && styles.modifiers.static)} id={uniqueId}>
157152
{isOpen && (
158153
<FocusTrap
159154
active={!disableFocusTrap}

packages/react-core/src/components/Dropdown/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
7777
alignments,
7878
contextProps,
7979
menuAppendTo = 'inline',
80-
isFlipEnabled = false,
80+
isFlipEnabled = true,
8181
removeFindDomNode = false,
8282
...props
8383
}: DropdownProps) => (

packages/react-core/src/components/Dropdown/DropdownWithContext.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
3030
onSelect: (): void => undefined,
3131
autoFocus: true,
3232
menuAppendTo: 'inline',
33-
isFlipEnabled: false
33+
isFlipEnabled: true
3434
};
3535

3636
constructor(props: DropdownProps & OUIAProps) {
@@ -93,15 +93,14 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
9393
renderedContent = React.Children.toArray(children);
9494
}
9595
const openedOnEnter = this.openedOnEnter;
96+
const isStatic = isFlipEnabled && menuAppendTo !== 'inline';
9697
return (
9798
<DropdownContext.Consumer>
9899
{({ baseClass, baseComponent, id: contextId, ouiaId, ouiaComponentType, ouiaSafe, alignments }) => {
99100
const BaseComponent = baseComponent as any;
100101
const menuContainer = (
101102
<DropdownMenu
102-
// This removes the `position: absolute` styling from the `.pf-c-dropdown__menu`
103-
// allowing the menu to flip correctly
104-
{...(isFlipEnabled && { style: { position: 'revert', minWidth: 'min-content' } })}
103+
className={css(isStatic && styles.modifiers.static)}
105104
setMenuComponentRef={this.setMenuComponentRef}
106105
component={component}
107106
isOpen={isOpen}

packages/react-core/src/components/Select/Select.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
266266
isInputFilterPersisted: false,
267267
isCreateSelectOptionObject: false,
268268
shouldResetOnSelect: true,
269-
isFlipEnabled: false,
269+
isFlipEnabled: true,
270270
removeFindDomNode: false
271271
};
272272

@@ -1258,11 +1258,10 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
12581258
}
12591259
}
12601260

1261+
const isStatic = isFlipEnabled && menuAppendTo !== 'inline';
12611262
const innerMenu = (
12621263
<SelectMenu
1263-
// This removes the `position: absolute` styling from the `.pf-c-select__menu`
1264-
// allowing the menu to flip correctly
1265-
{...(isFlipEnabled && { style: { position: 'revert' } })}
1264+
className={css(isStatic && styles.modifiers.static)}
12661265
{...props}
12671266
isGrouped={isGrouped}
12681267
selected={selections}

0 commit comments

Comments
 (0)