File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
packages/components/src/components/Select Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -228,16 +228,27 @@ export function SelectContainer({
228228 // 요소가 움직일 때마다(스크롤, 리사이즈 등) 위치를 갱신하도록 이벤트를 등록합니다.
229229 const updatePosition = ( ) => {
230230 const {
231+ width,
231232 height,
232233 x : comboboxX ,
233234 y : comboboxY ,
235+ top,
236+ left,
234237 } = combobox . getBoundingClientRect ( )
235238
236- if ( el . offsetHeight + comboboxY + y > window . innerHeight )
239+ const isOverflowBottom =
240+ el . offsetHeight + top + window . scrollY + height + y >
241+ document . documentElement . scrollHeight
242+
243+ const isOverflowRight =
244+ el . offsetWidth + left + window . scrollX + width + x >
245+ document . documentElement . scrollWidth
246+
247+ if ( isOverflowBottom )
237248 el . style . bottom = `${ window . innerHeight - comboboxY + 10 } px`
238249 else el . style . top = `${ comboboxY + height + 10 + y } px`
239250
240- if ( el . offsetWidth + comboboxX + x > window . innerWidth )
251+ if ( isOverflowRight )
241252 el . style . left = `${ comboboxX - el . offsetWidth + combobox . offsetWidth + x } px`
242253 else el . style . left = `${ comboboxX + x } px`
243254 }
You can’t perform that action at this time.
0 commit comments