Skip to content

Commit

Permalink
fix(timepicker): prevent scroll after closing panel
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Sep 30, 2022
1 parent f43ed54 commit 8738ef4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/time-picker/panel/single-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default defineComponent({
triggerScroll: Boolean,
onChange: Function,
resetTriggerScroll: Function,
isShowPanel: Boolean,
},

setup(props) {
Expand Down Expand Up @@ -174,6 +175,8 @@ export default defineComponent({
const handleScroll = (col: EPickerCols, idx: number) => {
let val: number | string;
let formattedVal: string;
if (!props.isShowPanel) return;

const scrollTop = (colsRef[idx]?.scrollTop || 0) + panelOffset.top;
const { offsetHeight, margin } = getItemHeight();
const timeItemTotalHeight = offsetHeight + margin;
Expand Down Expand Up @@ -323,10 +326,6 @@ export default defineComponent({
ref={(el) => (colsRef[idx] = el)}
class={`${panelClassName.value}-body-scroll`}
onScroll={debounce(() => handleScroll(col, idx), 50)}
style={{
'--timePickerPanelOffsetTop': panelOffset.top,
'--timePickerPanelOffsetBottom': panelOffset.bottom,
}}
>
{getColList(col).map((el) => (
<li
Expand Down
1 change: 1 addition & 0 deletions src/time-picker/panel/time-picker-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default defineComponent({
triggerScroll={triggerScroll.value}
onChange={props.onChange}
resetTriggerScroll={resetTriggerScroll}
isShowPanel={props.isShowPanel}
/>
</div>
{isFooterDisplay.value ? (
Expand Down

0 comments on commit 8738ef4

Please sign in to comment.