Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoComplete.InputGroup does not respect InputLeftElement #17

Closed
karimcambridge opened this issue Jul 1, 2021 · 6 comments
Closed

AutoComplete.InputGroup does not respect InputLeftElement #17

karimcambridge opened this issue Jul 1, 2021 · 6 comments
Assignees

Comments

@karimcambridge
Copy link

karimcambridge commented Jul 1, 2021

import {
	InputGroup,
	InputLeftElement,
	InputRightElement,
	Icon,
} from '@chakra-ui/react';
import {
	AutoComplete,
	AutoCompleteInput,
	AutoCompleteItem,
	AutoCompleteList,
	AutoCompleteGroup,
	AutoCompleteFixedItem,
  } from '@choc-ui/chakra-autocomplete';
  import { SearchIcon, ChevronRightIcon, ChevronDownIcon } from '@chakra-ui/icons';

const SearchBar = props => {
	const options = ['apple', 'appoint', 'zap', 'cap', 'japan'];
  
	return (
		<AutoComplete rollNavigation>
			{({ isOpen }) => (
				<>
					<InputGroup>
						<InputLeftElement
							pointerEvents="none"
							children={<SearchIcon />}
						/>
						<AutoCompleteInput
							variant="filled"
							placeholder="    Search..."
						/>
						<InputRightElement
							pointerEvents="none"
							children={
								<Icon as={isOpen ? ChevronRightIcon : ChevronDownIcon} />
							}
						/>
					</InputGroup>
					<AutoCompleteList>
						{options.map((option, oid) => (
							<AutoCompleteItem
								key={`optio-${oid}`}
								value={option}
								textTransform="capitalize"
								align="center"
							>
								{option}
							</AutoCompleteItem>
						))}
					</AutoCompleteList>
				</>
			)}
		</AutoComplete>
	);
};

export default SearchBar;

Result is
image

image

@anubra266
Copy link
Owner

Hi could you create a codesandbox reporoduction?

@karimcambridge
Copy link
Author

Hi, honestly after playing around and switching things up a bit it actually seems like the issue is the Input component from chakra itself, I switched to that.

Also, check out the screenshots, look at how the icon overlaps with the placeholder / cursor.

Hi could you create a codesandbox reporoduction?

@anubra266 anubra266 self-assigned this Jul 3, 2021
@anubra266
Copy link
Owner

anubra266 commented Jul 10, 2021

Hi @karimcambridge this is fixed in v3.5.2

@karimcambridge
Copy link
Author

karimcambridge commented Jul 10, 2021

Thank you, haven't tested it yet.

Also see someone reported something similar here

chakra-ui/chakra-ui#4366

@anubra266
Copy link
Owner

I just found out the package is breaking with the latest Chakra version. The list is jumping off the page😔

@karimcambridge
Copy link
Author

I just found out the package is breaking with the latest Chakra version. The list is jumping off the page😔

Yea that is happening, I tried to report it. chakra-ui/chakra-ui#4329

If you can help bring it to their attention, it needs to be fixed asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants