@@ -15,6 +15,7 @@ import React, {
1515import classnames from 'classnames' ;
1616import { FormElement , FormElementProps } from './FormElement' ;
1717import { Icon } from './Icon' ;
18+ import { AutoAlign } from './AutoAlign' ;
1819import { DropdownMenuProps } from './DropdownMenu' ;
1920import { isElInChildren } from './util' ;
2021import { ComponentSettingsContext } from './ComponentSettings' ;
@@ -584,30 +585,39 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
584585 />
585586 </ span >
586587 </ div >
587- { opened && (
588- < div
589- id = { listboxId }
590- className = { dropdownClassNames }
591- role = 'listbox'
592- aria-label = 'Options'
593- tabIndex = { 0 }
594- aria-busy = { false }
595- ref = { dropdownRef }
596- style = { { ...menuStyle , left : 0 , transform : 'translate(0)' } }
597- >
598- < ul
599- className = 'slds-listbox slds-listbox_vertical'
600- role = 'presentation'
601- onKeyDown = { onKeyDown }
602- onBlur = { onBlur }
603- >
604- < PicklistContext . Provider value = { contextValue } >
605- { children }
606- </ PicklistContext . Provider >
607- </ ul >
608- </ div >
609- ) }
610588 </ div >
589+ { opened && (
590+ < AutoAlign
591+ triggerSelector = '.react-slds-picklist'
592+ alignmentStyle = 'menu'
593+ portalClassName = { classnames ( className , 'slds-picklist' ) }
594+ portalStyle = { menuStyle }
595+ size = { menuSize }
596+ >
597+ { ( { autoAlignContentRef } ) => (
598+ < div
599+ id = { listboxId }
600+ className = { dropdownClassNames }
601+ role = 'listbox'
602+ aria-label = 'Options'
603+ tabIndex = { 0 }
604+ aria-busy = { false }
605+ ref = { useMergeRefs ( [ dropdownRef , autoAlignContentRef ] ) }
606+ >
607+ < ul
608+ className = 'slds-listbox slds-listbox_vertical'
609+ role = 'presentation'
610+ onKeyDown = { onKeyDown }
611+ onBlur = { onBlur }
612+ >
613+ < PicklistContext . Provider value = { contextValue } >
614+ { children }
615+ </ PicklistContext . Provider >
616+ </ ul >
617+ </ div >
618+ ) }
619+ </ AutoAlign >
620+ ) }
611621 </ div >
612622 </ FormElement >
613623 ) ;
0 commit comments