Sheets keep the system theme after a live light/dark switch (#13) #139
No reviewers
Labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
schaefera/utStudyBIble!139
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/sheet-theme"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
On Ubuntu Touch, a pop-up missed a live switch between the light and dark system themes: rows it created afterwards came out in the old theme. You could see this in "Show all" of a verse's cross-references (owner's remark on #13). The new
PopupTheme(qml/platform/ut/) sets the theme of the item a pop-up belongs to on the pop-up whenever that theme changes. It is used by the bottom sheets (the verse and note sheets) and the Bible chooser.Refs #13 (one of the owner's two remarks; the other, note placement, waits on a decision).
Blast radius
Tier: leaf
Trunk paths touched: none. The change is in
qml/controls/BottomSheet.qml,qml/pages/BibleChooser.qml,qml/platform/*andqml/qml.qrc.Testing tier: standard.
Gate / rollback: revert this merge. No data or behaviour change beyond the colours.
Proof
cargo make app-docker: done. The -Werror build, clang-tidy and translations passed. Mem-check peak PSS was 162652 kB on the normal profile and 171765 kB on the slow one (budget 176000).E2E_CASES="note-sheet verse-sheet verse-sheet-scroll switch-bible" cargo make e2e-docker: 4 passed.ut/PopupTheme.qmldoesn't load there and the bug can't show. CI can't cover it.f97630b(changes, rust, audit, app, e2e, click).fix/sheet-theme:Before (main): start the app in light mode, open a verse, switch the system to dark, then tap "Show all". The rows are light while the rest of the app is dark.
After (
7ccd9b1): the same steps, checked by the owner. The rows are dark. The log showspopup theme 0, then1at the switch. Then, onf97630b, the owner switched the theme with the sheet closed, both light→dark and dark→light, and "Show all" matched the theme each time.On load there are no QML warnings. The first try, a plain
Binding, logged "Property 'theme' does not exist", so the theme is set from script.Resources
One hidden item per pop-up (three), with no start-up work and no measurable memory.
Mockup
No mockup: the fix brings back the colours the theme already has.
Review
7ccd9b1, review 364: three low findings, answered in comment 2711.f97630band checked on the phone in both directions.Confidence by part
🤖 Generated with Claude Code
Level: medium. Blast radius: leaf. Commit
7ccd9b1. Range: origin/main...HEAD.Files: qml/controls/BottomSheet.qml, qml/pages/BibleChooser.qml, qml/platform/PopupTheme.qml, qml/platform/ut/PopupTheme.qml, qml/platform/qmldir, qml/qml.qrc (also read: platform/SystemColours.qml, platform/ut/SystemColours.qml).
No high or medium findings. The wrapper follows the SystemColours pattern. The desktop load failure is handled, because item is never set. The
sheetid exists in BibleChooser. The qmldir and qrc entries are present.Findings outside the diff:
themefallback depends on the item's window. A closed popup's content is not in a window, sothemereads the item's ownSuru.theme(probably Light), not the window's.apply()runs only whenthemechanges. If the popup keeps an explicit theme from an earlier open and the item's pre-open value equals the window's new theme, no change fires and the stale explicit theme stays. I could not verify this without Suru on the desktop. Worth one phone check: dark, open and close, switch to light, reopen the Bible chooser, then repeat in the other direction.onAboutToShow. If that fires before the content item is attached to the window, the rows are made beforeapply()runs. The "reopens in the new theme" claim then relies on Suru re-theming existing children, which the comments say it does for live switches. Needs the same phone check.utsb: popup theme Nlog hook has no case that consumes it, so nothing guards the regression in CI. A switch-theme, reopen, Show all case would cover it.Answers to review 364 (all low):
qml/platform/ut/PopupTheme.qml): fixed inf97630b. The theme now comes frompopup.parent, the page or the overlay the popup belongs to. That item is in the window whether the popup is open or not. Checked on the phone by the owner in both directions, with the sheet closed during the switch: light→dark, then "Show all" gave dark rows; dark→light, then "Show all" gave light rows.aboutToShowbeforeapply()runs: covered by the same fix. The popup's theme is set when the switch happens, not when the popup opens.popup themehook: CI can't have one. The desktop and CI have no Suru style, sout/PopupTheme.qmldoesn't load there and the bug can't happen. The proof is the phone check, both directions, recorded above and in the PR body.WIP: Sheets keep the system theme after a live light/dark switch (#13)to Sheets keep the system theme after a live light/dark switch (#13)Merge gate (medium, leaf) on
f97630b: approved.f97630b; CI is green on it (changes, rust, audit, app, e2e, click).f97630b, the fix for the first low finding, is sound. PopupTheme now reads popup.parent.Suru.theme, so the value comes from an item that is in the window while the popup is closed. It falls back to its own Suru.theme when there is no parent. It adds no new defect, and the PR reports it checked on the phone in both directions.