Skip to content

fix: hide scroll arrows at list boundary in popup - #3518

Closed
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/442c4bb0d8f5
Closed

mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/442c4bb0d8f5

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Root Cause Analysis

In the timezone selection popup (SearchableListViewPopup.qml), the up/down scroll arrow buttons' visible property was bound only to listView.interactive (whether the list is scrollable), without checking the scroll position. This means the arrows remained visible even when the user scrolled to the top or bottom of the list. The down arrow had enabled: !listView.atYEnd but visible was still true, so it only grayed out instead of disappearing.

Key evidence: SearchableListViewPopup.qml:187 (up arrow) and :265 (down arrow) both had visible: listView.interactive without atYBeginning/atYEnd boundary checks.

Fix

Added !listView.atYBeginning to the up arrow's visible binding and !listView.atYEnd to the down arrow's visible binding, using Qt Quick ListView standard read-only properties. Only 2 lines changed, no new dependencies or refactoring.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • Target lines were introduced in a refactor (commit f4845fcc, DTK Popup replacement), not a previous bug fix — this change does not revert any historical fix
  • No external callers reference the upButton/downButton QML component IDs; changes are local to the popup component

Business Impact Scope

The change affects the timezone list popup in Control Center's Date & Time module. When the list has more than 10 items (scrollable), scrolling to the top now hides the up arrow and scrolling to the bottom hides the down arrow. When the list has fewer than 10 items, both arrows remain hidden (unchanged behavior). The ColumnLayout automatically redistributes space when arrows become invisible, so popup height stays the same.

Verification Suggestion

Test the timezone list popup with more than 10 items: scroll to top/bottom and verify arrows hide, then scroll back to middle and verify arrows reappear. Also verify arrows stay hidden when the list has fewer than 10 items.


根因分析

在时区选择弹窗(SearchableListViewPopup.qml)中,上下滚动箭头按钮的 visible 属性仅绑定了 listView.interactive(列表是否可滚动),未检查滚动位置。这导致用户滚动到列表顶部或底部时箭头仍然可见。下箭头虽有 enabled: !listView.atYEndvisible 仍为 true,仅变灰未消失。

关键证据:SearchableListViewPopup.qml:187(上箭头)和 :265(下箭头)的 visible 绑定均缺少 atYBeginning/atYEnd 边界判断。

修复方案

在上箭头 visible 绑定中追加 !listView.atYBeginning,在下箭头 visible 绑定中追加 !listView.atYEnd,利用 Qt Quick ListView 标准只读属性。仅改动 2 行,无新依赖或重构。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 目标行由重构 commit(f4845fcc,DTK Popup 替换)引入,非历史 bug 修复产物——本次修改不会撤销历史修复
  • 无外部调用者引用 upButton/downButton 组件 ID,改动局限于弹窗组件内部

业务影响范围

改动影响控制中心时间和日期模块的时区列表弹窗。列表超过 10 项(可滚动)时,滚动到顶部隐藏上箭头、滚动到底部隐藏下箭头。列表不足 10 项时两个箭头均不显示(行为不变)。箭头不可见时 ColumnLayout 自动重新分配空间,弹窗高度不变。

验证建议

测试时区列表弹窗超过 10 项时:滚动到顶部/底部验证箭头消失,滚回中间验证箭头重新出现。同时验证列表不足 10 项时箭头不显示。

Summary by Sourcery

Bug Fixes:

  • Hide the timezone popup’s scroll arrows when the list is already at the corresponding top or bottom boundary.

1. Root cause: arrow buttons visible only bound to
   listView.interactive, missing atYBeginning/atYEnd checks
2. Fix: add !listView.atYBeginning to upButton visible and
   !listView.atYEnd to downButton visible binding
3. Impact: arrows hide at list top/bottom, no change when list
   has fewer items than maxVisibleItems

Log: Fix scroll arrows not hiding at list boundaries in timezone popup

Influence:
1. Test timezone list with more than 10 items, scroll to top and
   verify up arrow hides
2. Scroll to bottom and verify down arrow hides
3. Verify arrows reappear when scrolling back to middle
4. Verify arrows hidden when list has fewer than 10 items

fix: 修复时区列表箭头在列表边界不隐藏的问题

1. 根因:箭头按钮 visible 仅绑定 listView.interactive,缺少
   atYBeginning/atYEnd 滚动位置判断
2. 方案:上箭头 visible 追加 !listView.atYBeginning,下箭头追加
   !listView.atYEnd,利用 Qt Quick ListView 标准属性
3. 影响:箭头在列表顶部/底部自动隐藏,列表项数不足时不显示

Log: 修复时区列表滚动到顶部或底部时箭头不消失的问题

Influence:
1. 测试时区列表超过 10 项时滚动到顶部,验证上箭头消失
2. 滚动到底部,验证下箭头消失
3. 从中间位置滚动验证箭头正确切换显隐
4. 验证列表项数不足 10 项时上下箭头均不显示

PMS: BUG-333099

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @mhduiy, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 3 hours and 10 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the timezone selection popup to hide the up arrow at the list’s top and the down arrow at its bottom, while preserving the existing behavior for non-scrollable and mid-scroll states.

State diagram for timezone list arrow visibility

stateDiagram-v2
    [*] --> NonScrollable
    NonScrollable --> NonScrollable: listView.interactive = false
    ScrollableMiddle --> Top: listView.atYBeginning
    ScrollableMiddle --> Bottom: listView.atYEnd
    Top --> ScrollableMiddle: !listView.atYBeginning
    Bottom --> ScrollableMiddle: !listView.atYEnd

    state NonScrollable {
        upButton: hidden
        downButton: hidden
    }
    state Top {
        upButton: hidden
        downButton: visible
    }
    state ScrollableMiddle {
        upButton: visible
        downButton: visible
    }
    state Bottom {
        upButton: visible
        downButton: hidden
    }
Loading

File-Level Changes

Change Details Files
Make popup scroll arrows visible only when additional content exists in their respective direction.
  • Add a top-boundary check to the up-arrow visibility binding.
  • Add a bottom-boundary check to the down-arrow visibility binding.
src/plugin-datetime/qml/SearchableListViewPopup.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@mhduiy

mhduiy commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

这里上下箭头消失会导致布局跳动,保持原有设计,滚动到顶部或者底部的时候设置为disable的状态

@mhduiy mhduiy closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants