mirror of
https://github.com/logto-io/logto.git
synced 2025-04-14 23:11:31 -05:00
fix(ui): set tabIndex -1 for hidden countryCode (#3842)
setTabIndex -1 for hidden countryCode
This commit is contained in:
parent
0023dfe38a
commit
baa16b0bb7
2 changed files with 4 additions and 3 deletions
|
@ -48,7 +48,7 @@ const AnimatedPrefix = ({ children, isVisible }: Props) => {
|
|||
|
||||
return (
|
||||
<animated.div className={styles.prefix} style={animation} data-testid="prefix">
|
||||
{cloneElement(children, { ref: elementRef })}
|
||||
{cloneElement(children, { ref: elementRef, isVisible })}
|
||||
</animated.div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -14,11 +14,12 @@ type Props = {
|
|||
className?: string;
|
||||
value?: string;
|
||||
inputRef?: Nullable<HTMLInputElement>;
|
||||
isVisible?: boolean;
|
||||
onChange?: (value: string) => void;
|
||||
};
|
||||
|
||||
const CountryCodeSelector = (
|
||||
{ className, value, inputRef, onChange }: Props,
|
||||
{ className, value, inputRef, isVisible = true, onChange }: Props,
|
||||
ref: ForwardedRef<HTMLDivElement>
|
||||
) => {
|
||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
||||
|
@ -41,7 +42,7 @@ const CountryCodeSelector = (
|
|||
ref={ref}
|
||||
className={classNames(styles.countryCodeSelector, className)}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
tabIndex={isVisible ? 0 : -1}
|
||||
onClick={showDropDown}
|
||||
onKeyDown={onKeyDownHandler({
|
||||
Enter: showDropDown,
|
||||
|
|
Loading…
Add table
Reference in a new issue