From cb46af6ffc04ca0f0d214385667774b5aca50780 Mon Sep 17 00:00:00 2001 From: Valerio Date: Mon, 27 Jun 2022 16:07:10 +0200 Subject: [PATCH 1/3] fix(SearchInput): use popper to control the popup in advanced search --- .../components/SearchInput/SearchInput.tsx | 20 ++++++++++++++----- .../__snapshots__/SearchInput.test.tsx.snap | 6 ++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/react-core/src/components/SearchInput/SearchInput.tsx b/packages/react-core/src/components/SearchInput/SearchInput.tsx index e74ccb2f560..4613ff5bb2f 100644 --- a/packages/react-core/src/components/SearchInput/SearchInput.tsx +++ b/packages/react-core/src/components/SearchInput/SearchInput.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { css } from '@patternfly/react-styles'; -import styles from '@patternfly/react-styles/css/components/SearchInput/search-input'; import { Button, ButtonVariant } from '../Button'; import { Badge } from '../Badge'; import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon'; @@ -12,6 +11,7 @@ import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-i import { AdvancedSearchMenu } from './AdvancedSearchMenu'; import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities } from '../TextInputGroup'; import { InputGroup } from '../InputGroup'; +import { Popper } from '../../helpers'; export interface SearchAttribute { /** The search attribute's value to be provided in the search input's query string. @@ -277,11 +277,9 @@ const SearchInputBase: React.FunctionComponent = ({ if (!!onSearch || attributes.length > 0 || !!onToggleAdvancedSearch) { if (attributes.length > 0) { - return ( -
- {buildSearchTextInputGroupWithExtraButtons()} + const advancedSearch = ( + = ({ getAttrValueMap={getAttrValueMap} isSearchMenuOpen={isSearchMenuOpen} /> + + ); + + return ( +
+ document.querySelector('#custom-advanced-search')} + />
); } diff --git a/packages/react-core/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap b/packages/react-core/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap index 37a92b570dc..269154aa7b4 100644 --- a/packages/react-core/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +++ b/packages/react-core/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap @@ -3,10 +3,11 @@ exports[`SearchInput advanced search 1`] = `