Skip to content

Commit

Permalink
chore: make sure using computed styles
Browse files Browse the repository at this point in the history
  • Loading branch information
YUCLing committed Nov 20, 2024
1 parent ea21ef4 commit 0cdb1b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ export default abstract class AutocompleteDropdown<

let scrollTop;
if (itemTop < dropdownTop) {
scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt(dropdown.style.paddingTop, 10);
scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt(getComputedStyle(dropdown).paddingTop, 10);
} else if (itemBottom > dropdownBottom) {
scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt(dropdown.style.paddingBottom, 10);
scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt(getComputedStyle(dropdown).paddingBottom, 10);
}

if (typeof scrollTop !== 'undefined') {
Expand Down
4 changes: 2 additions & 2 deletions framework/core/js/src/forum/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone

let scrollTop;
if (itemTop < dropdownTop) {
scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt(dropdown.style.paddingTop, 10);
scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt(getComputedStyle(dropdown).paddingTop, 10);
} else if (itemBottom > dropdownBottom) {
scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt(dropdown.style.paddingBottom, 10);
scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt(getComputedStyle(dropdown).paddingBottom, 10);
}

if (typeof scrollTop !== 'undefined') {
Expand Down

0 comments on commit 0cdb1b7

Please sign in to comment.