Skip to content

Commit 294a954

Browse files
committed
fix: prevent ListView overscroll in notification panel
Added overscroll protection to the notification center ListView to prevent unwanted bounce-back behavior when scrolling beyond content boundaries. The fix includes three event handlers that monitor height, content height, and content position changes to ensure the scroll position stays within valid bounds. Implemented bounds checking in onHeightChanged, onContentHeightChanged, and onContentYChanged handlers to clamp the contentY position when it exceeds the content boundaries. This prevents the ListView from showing empty space when scrolled beyond the actual content area, which was causing visual glitches and inconsistent scrolling behavior. Influence: 1. Test scrolling to the top and bottom of notification list 2. Verify no empty space appears when reaching content boundaries 3. Check that normal scrolling behavior remains smooth 4. Test with various numbers of notifications (empty, few, many) 5. Verify scroll position is maintained during content updates PMS: BUG-284867
1 parent 9861612 commit 294a954

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

panels/notification/center/NotifyView.qml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@ Control {
7272
property int pendingFocusIndex: -1 // Index to focus after expand operation
7373
property bool panelShown: false
7474

75+
// ListView滚轮回弹行为是默认行为,需要手动修正
76+
onHeightChanged: {
77+
if (contentHeight > height && contentY > contentHeight - height) {
78+
contentY = Math.max(0, contentHeight - height)
79+
}
80+
}
81+
onContentHeightChanged: {
82+
if (contentHeight > height && contentY > contentHeight - height) {
83+
contentY = Math.max(0, contentHeight - height)
84+
}
85+
}
86+
onContentYChanged: {
87+
if (contentY < -1) {
88+
contentY = 0
89+
} else if (contentHeight > height && contentY > contentHeight - height + 1) {
90+
contentY = contentHeight - height
91+
}
92+
}
93+
7594
// Forward signals from delegate to root for Tab cycling
7695
function gotoHeaderFirst() { root.gotoHeaderFirst() }
7796
function gotoHeaderLast() { root.gotoHeaderLast() }

0 commit comments

Comments
 (0)