Skip to content
5 changes: 3 additions & 2 deletions src/scripts/Lookup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ const LookupSelectedState: FC<LookupSelectedStateProps> = ({
size='small'
/>
)}
<div
<button
type='button'
role='combobox'
tabIndex={disabled ? -1 : 0}
className='slds-input_faux slds-combobox__input slds-combobox__input-value'
Expand All @@ -161,7 +162,7 @@ const LookupSelectedState: FC<LookupSelectedStateProps> = ({
aria-expanded='false'
>
<span className='slds-truncate'>{selected.label}</span>
</div>
</button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are u willing to change back to button, not the div ? Have u checked the focus difference ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stomita
As we discussed, it would be better to use <input type="text" readonly /> instead of changing back to button.
I did it in 4adb664.

Furthermore, I added a stringify logic in 6ab7b63.
I would appreciate if you confirm it as well.

<Button
type='icon'
icon='close'
Expand Down
15 changes: 8 additions & 7 deletions src/scripts/Picklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export type PicklistProps<MultiSelect extends boolean | undefined> = {
tooltip?: ReactNode;
tooltipIcon?: string;
elementRef?: Ref<HTMLDivElement>;
inputRef?: Ref<HTMLDivElement>;
buttonRef?: Ref<HTMLButtonElement>;
dropdownRef?: Ref<HTMLDivElement>;
onValueChange?: Bivariant<
(
Expand Down Expand Up @@ -216,7 +216,7 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
tooltip,
tooltipIcon,
elementRef: elementRef_,
inputRef: inputRef_,
buttonRef: buttonRef_,
dropdownRef: dropdownRef_,
onSelect,
onComplete,
Expand Down Expand Up @@ -338,8 +338,8 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(

const elRef = useRef<HTMLDivElement | null>(null);
const elementRef = useMergeRefs([elRef, elementRef_]);
const comboboxElRef = useRef<HTMLDivElement | null>(null);
const inputRef = useMergeRefs([comboboxElRef, inputRef_]);
const comboboxElRef = useRef<HTMLButtonElement | null>(null);
const buttonRef = useMergeRefs([comboboxElRef, buttonRef_]);
const dropdownElRef = useRef<HTMLDivElement | null>(null);
const dropdownRef = useMergeRefs([dropdownElRef, dropdownRef_]);

Expand Down Expand Up @@ -572,8 +572,9 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
className='slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right'
role='none'
>
<div
ref={inputRef}
<button
type='button'
ref={buttonRef}
role='combobox'
tabIndex={disabled ? -1 : 0}
className={inputClassNames}
Expand All @@ -590,7 +591,7 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
{...rprops}
>
<span className='slds-truncate'>{selectedItemLabel}</span>
</div>
</button>
<Icon
containerClassName='slds-input__icon slds-input__icon_right'
category='utility'
Expand Down