diff --git a/pages/autosuggest/simple.page.tsx b/pages/autosuggest/simple.page.tsx index 685e53680a..518ada2be8 100644 --- a/pages/autosuggest/simple.page.tsx +++ b/pages/autosuggest/simple.page.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import Autosuggest from '~components/autosuggest'; -const empty = Nothing found; +const empty = undefined; const options = [ { value: 'Option 0', tags: ['tag1', 'tag2'], filteringTags: ['bla', 'opt'], description: 'description1' }, { value: 'Option 1', labelTag: 'This is a label tag' }, @@ -14,7 +14,7 @@ const enteredTextLabel = (value: string) => `Use: ${value}`; export default function AutosuggestPage() { const [value, setValue] = useState(''); const [readOnly, setReadOnly] = useState(false); - const [hasOptions, setHasOptions] = useState(true); + const [hasOptions, setHasOptions] = useState(false); return (
diff --git a/src/autosuggest/internal.tsx b/src/autosuggest/internal.tsx index 01322bcfc4..efac6f86f8 100644 --- a/src/autosuggest/internal.tsx +++ b/src/autosuggest/internal.tsx @@ -180,7 +180,7 @@ const InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, r onRecoveryClick: handleRecoveryClick, filteringResultsText: filteredText, }); - + console.log({ isEmpty }); return ( } onMouseDown={handleDropdownMouseDown} - open={open && !!dropdownContent} + open={true} footer={ dropdownFooterRef && (
diff --git a/src/internal/components/dropdown/index.tsx b/src/internal/components/dropdown/index.tsx index aaa04b17e7..444eedb1f6 100644 --- a/src/internal/components/dropdown/index.tsx +++ b/src/internal/components/dropdown/index.tsx @@ -91,8 +91,10 @@ const TransitionContent = ({ role, ariaLabelledby, ariaDescribedby, + isEmpty, }: TransitionContentProps) => { const contentRef = useMergeRefs(dropdownRef, transitionRef); + console.log({ header, children, isEmpty }); return (
-
-
-
- - {header} - {children} - {footer} - -
+
+
+ + {header} + {children} + {footer} +
@@ -158,6 +164,7 @@ const Dropdown = ({ dropdownContentRole, ariaLabelledby, ariaDescribedby, + isEmpty, }: DropdownProps) => { const wrapperRef = useRef(null); const triggerRef = useRef(null); @@ -426,6 +433,7 @@ const Dropdown = ({ role={dropdownContentRole} ariaLabelledby={ariaLabelledby} ariaDescribedby={ariaDescribedby} + isEmpty={isEmpty} > {children} diff --git a/src/internal/components/dropdown/styles.scss b/src/internal/components/dropdown/styles.scss index adba7e5717..d2008ae365 100644 --- a/src/internal/components/dropdown/styles.scss +++ b/src/internal/components/dropdown/styles.scss @@ -49,6 +49,11 @@ } border-bottom: none; + + // Don't show dropdown border when there's no dropdown content + &.is-empty::after { + display: none; + } } &-drop-up { @@ -96,10 +101,6 @@ overflow: scroll; } } - // Don't show dropdown border when there's no dropdown content - &.is-empty::after { - display: none; - } } .dropdown-content { @@ -108,13 +109,6 @@ width: 100%; } -// Child flex wrapper used because when combining an absolute position -// and flexbox, IE11 will incorrectly size the container according to its parent -// and not its content. -.ie11-wrapper { - display: flex; -} - .stretch-trigger-height { height: 100%; }