Skip to content
17 changes: 16 additions & 1 deletion src/scripts/Picklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { FormElement, FormElementProps } from './FormElement';
import { Icon } from './Icon';
import { AutoAlign, RectangleAlignment } from './AutoAlign';
import { DropdownMenuProps } from './DropdownMenu';
import { isElInChildren } from './util';
import { registerStyle, isElInChildren } from './util';
import { ComponentSettingsContext } from './ComponentSettings';
import { useControlledValue, useEventCallback, useMergeRefs } from './hooks';
import { createFC } from './common';
Expand Down Expand Up @@ -185,6 +185,18 @@ const PicklistContext = createContext<{
optionIdPrefix: '',
});

/**
*
*/
function useInitComponentStyle() {
useEffect(() => {
registerStyle('picklist', [
['.react-picklist-input:focus-visible', '{ outline: none; }'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you are willing to cancel the focus ring of the control, it is not working right now.
I think it is not required to remove the ring for the focused picklist.

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
I got it.
I fixed it in 42543c5.

['.react-picklist-input:not(:disabled)', '{ cursor: pointer; }'],
]);
}, []);
}

/**
*
*/
Expand Down Expand Up @@ -262,6 +274,8 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
...rprops
} = props;

useInitComponentStyle();

const fallbackId = useId();
const id = id_ ?? fallbackId;
const listboxId = `${id}-listbox`;
Expand Down Expand Up @@ -557,6 +571,7 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
}
);
const inputClassNames = classnames(
'react-picklist-input',
'slds-input_faux',
'slds-combobox__input',
{
Expand Down