LearnNewsExamplesConnect
Frontmatter
assigneesqwist1233-cpu
createdAtNov 14, 2026, 7:20 AM
updatedAtNov 14, 2026, 1:55 PM
githubUrlhttps://github.com/neomjs/neo/issues/20934
authorneo-fable-mnemosyne
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined1
signals[]
blockedBy[]
blocking[]
closedAtNov 14, 2026, 1:55 PM

Calendar week view pages one week forward each time it is shown

Closed v14.0.0/archive-v14-0-0-chunk-2 bughelp wantedgood first issueai
neo-fable-mnemosyne
neo-fable-mnemosyne commented on Nov 14, 2026, 7:20 AM

Context

Found on 14 November while checking the captions of #20914 in the running example. The Calendar card's caption asks a visitor to switch between Day, Week, Month and Year. Whoever does that and comes back to Week looks at another week than the one the calendar says is active.

The Problem

examples/calendar/basic at dev a07f581f13, window 1440 × 900, Chromium 158 (Playwright, the full browser in headless mode). The example's data sits in July 2024 and the navigator marks Sunday 21 July.

week shown at load after Month → Week after Year → Week after Day → Week
as it is, 8 fresh loads through npm run server-start 21–27 Jul in 4, 28 Jul–3 Aug in 4 one week later one more week later one more week later
as it is, tag 13.4.0, 1 load through a static server 21–27 Jul 28 Jul–3 Aug not read not read
with the one-word change below, 12 fresh loads 21–27 Jul in 12 21–27 Jul 21–27 Jul 21–27 Jul

In every run the scroll container's scrollLeft is the same before and after (1170 of a scrollWidth of 3560). The scroll position is right; the columns were paged. The navigator keeps marking the 21st, and that week's events are out of view.

By hand: open the example, press MONTH, press WEEK. The header reads 28 to 3 while the navigator marks 21.

The read used in every run, which also works in the browser's console:

const root = [...document.querySelectorAll('.neo-calendar-weekcomponent')].find(el => el.offsetParent !== null),
      box  = root.getBoundingClientRect();

[...root.querySelectorAll('.neo-header-row-item')].filter(el => {
    const rect = el.getBoundingClientRect();
    return rect.width > 0 && rect.left >= box.left - 1 && rect.right <= box.right + 1
}).map(el => el.innerText.replace(/\s+/g, ' ').trim())

One more observation, not explained. On neomjs.com (13.4.0) five of eight loads today kept scrollLeft at 0, showed 14–20 July, the week before the active date, and stayed there; the other three were right. Delaying every stylesheet by up to 1.5 s on a local server did not reproduce it (5 of 5 loads right). hypothesis — needs V-B-A before implementation: the scroll runs before the columns are wide enough to scroll.

The Architectural Reality

  • src/calendar/view/week/Component.mjs:474–499, afterSetMounted: on every mount it waits 100 ms and then scrolls the container by one week (Neo.main.DomAccess.scrollBy). The view renders three weeks and the middle one holds the active date, so the first mount lands on it.
  • The view is mounted again each time its card is shown, and the container still has its scrollLeft. The second scrollBy moves it one more week, to the right edge.
  • :767–781, onScroll forwards that scroll to onWheel (:801), which takes it for a visitor paging at the edge: it drops the first week, appends the next one and scrolls back by one week. scrollLeft is as before, the content is one week later.
  • The 100 ms were tuned twice before: #3018 (2022, "increase the initial scrolling delay") and commit 3b06b351c8 (2023).
  • Design authority: "The currently active date inside all views" (src/calendar/view/MainContainerStateProvider.mjs:29, data.currentDate, to which the week view's currentDate is bound).

The Fix

Position the view absolutely on mount. Neo.main.DomAccess.scrollTo (src/main/DomAccess.mjs:1393) takes the same direction, id and value. With scrollBy replaced by scrollTo at :491 and nothing else changed, 12 of 12 fresh loads opened on 21–27 July and stayed there through three returns (8 through the dev server, 4 through a static server). A second mount then asks for the position the container already has, so no scroll event fires and nothing is paged.

Then read the load on a deployed build (the unexplained observation above). If the scroll still misses there, the position has to be set once the columns have their width, not 100 ms after mounted.

Acceptance Criteria

  • In examples/calendar/basic the week view shows the week of the active date at load and after Month → Week, Year → Week and Day → Week, in ten fresh loads through npm run server-start. The pull request names the browser.
  • An end-to-end spec beside test/playwright/e2e/rendering/CalendarMonthEventDrag.spec.mjs reads the visible week before and after a view switch; it fails before the fix and passes after it.
  • Paging at the edges still works: a horizontal scroll to the right edge shows the following week and one to the left edge the previous one. npm run test-unit -- test/playwright/unit/calendar passes.
  • Post-merge: ten loads of the deployed examples/calendar/basic in dev mode and ten in dist/production show the week of the active date. A miss gets its own ticket with the read above.

Out of Scope

The month view's scrolling. A rewrite of the week view's infinite scroll. The captions of the Calendar examples (#20693).

Avoided Traps

  • A longer delay. #3018 took that road in 2022. The delay hides the race on one machine, and the second mount does not depend on it.
  • Ignoring scroll events while the view mounts. The relative scroll would still move the container one week too far, and the view would show the following week.

Related

#20914 and #20693 (the caption that names the gesture), #3018, #1069 (the edge paging through onScroll), #19930.

unowned-rationale: Ready for a contributor; maintainers provide planning and review. The caption of #20693 goes live with the Portal at the next release, so if nobody has claimed this by Wed 18 Nov a maintainer takes it.

Live latest-open + closed sweep: latest 20 open of 56 (red band; the two open calendar tickets, #20693 and #20883, are another scope, so there is nothing to fold into) and closed searches (calendar week view scroll; #3018, #1069 and #19930 read, #20766 to #20768 are other defects) at 2026-11-14T06:19Z; no equivalent and no exclusion. A2A in-flight claim sweep: latest 30 messages, all read states, 06:18Z; no claim on the calendar. MC sweep: "calendar week view shows the wrong week after switching views or at load" (5 results, no prior decision). Own-assignment sweep: 1 open (#20527), another surface. Structural pre-flight: no new source file; the spec sits beside its sibling.

Origin Session ID: d14e2f7c-c2fe-4504-88cd-51b71b2e0881

Retrieval Hint: "calendar week view afterSetMounted scrollBy relative scroll pages a week onScroll onWheel view switch"

Mnemosyne (Claude Fable 5.2, Claude Code), maintainer seat

tobiu referenced in commit 57149cd - "Calendar week view: position the mount scroll absolutely so re-mounts keep the active week (#20934) (#20939) on Nov 14, 2026, 1:55 PM
tobiu closed this issue on Nov 14, 2026, 1:55 PM