Skip to content

CMM-2198: Only drill down the Views bar chart on a deliberate tap - #23172

Merged
nbradbury merged 5 commits into
trunkfrom
issue/CMM-2198-new-stats-scrolling-changes-dates
Aug 4, 2026
Merged

CMM-2198: Only drill down the Views bar chart on a deliberate tap#23172
nbradbury merged 5 commits into
trunkfrom
issue/CMM-2198-new-stats-scrolling-changes-dates

Conversation

@nbradbury

@nbradbury nbradbury commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

The Views bar chart drilled down from the marker's onHidden callback. The marker shows on pointer-down and hides on pointer-up, so any gesture that started on the chart — including a vertical scroll — was indistinguishable from a tap. It silently collapsed the selected period to a single day, reloaded every Traffic card, and persisted across launches. Two users reported this in 27.0 Play Store reviews.

The marker's visibility callbacks now only record which bar the pointer is over. The drill-down fires from detectTapGestures, which an enclosing scroll cancels by consuming the drag. Tooltip behaviour is unchanged.

Testing instructions

  • Using trunk, open stats for a site that has traffic
  • Tap the overflow menu on the Views card and change it to a bar chart
  • Scroll the card, and notice when you lift your finger the date range changes to a single day
  • Pull this branch and verify the problem no longer occurs

The bar chart's drill-down was triggered from the marker's onHidden
callback. With the default show-on-press marker controller, the marker
shows on pointer-down and hides on pointer-up, so any gesture that
started on the chart -- including a vertical scroll -- ended in a
"hidden" callback that was indistinguishable from a tap. That silently
collapsed the selected period to a single day (or month), reloaded every
Traffic card, and persisted the change across launches.

Switch the bar chart to the toggle-on-tap marker controller, which only
accepts Interaction.Tap. Vico validates those against touch slop and the
long-press timeout, so a scroll no longer registers as a bar selection.
The drill-down now fires from onShown, making the lastShownIndex
bookkeeping unnecessary.
@nbradbury nbradbury added the Stats label Aug 3, 2026
@dangermattic

dangermattic commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr23172-b723972
Build Number1498
Application IDcom.jetpack.android.prealpha
Commitb723972
Installation URL24oogghjnoueo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr23172-b723972
Build Number1498
Application IDorg.wordpress.android.prealpha
Commitb723972
Installation URL5nk8qa3743ii0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.84%. Comparing base (2eab73c) to head (b723972).
⚠️ Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...s/android/ui/newstats/viewsstats/ViewsStatsCard.kt 0.00% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #23172   +/-   ##
=======================================
  Coverage   37.84%   37.84%           
=======================================
  Files        2345     2345           
  Lines      127530   127530           
  Branches    17715    17716    +1     
=======================================
  Hits        48258    48258           
  Misses      75313    75313           
  Partials     3959     3959           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The previous commit switched the bar chart to the toggle-on-tap marker
controller. That fixed the scroll case but broke two others, because
Vico only calls onShown when previousMarkerTargetHashCode transitions
from null and toggle-on-tap leaves the marker visible after a tap:

- Only the first tap drilled down. Later taps changed the marker's
  targets, so they routed to onUpdated and did nothing.
- markerX is a rememberSaveable but the chart's hash code is not, so
  recreating the activity replayed onShown and drilled down with no
  user interaction at all.

Go back to the default show-on-press controller, which also restores
press-and-hold tooltips, and use the marker callbacks only to record
which bar the pointer is over. The drill-down now fires from
detectTapGestures, which an enclosing scroll cancels by consuming the
drag.
pressedIndex was only ever written, never cleared, so it survived past
the gesture that set it. The axis labels sit inside this composable but
outside the chart's layer bounds, so tapping one produces no marker and
no onShown -- yet detectTapGestures still fires, drilling into whichever
bar was pressed last. The same stale index also outlived the data reload
that a drill-down triggers, where it pointed at an unrelated bucket.

Clear it in onHidden, which Vico dispatches from the draw that follows
the pointer-up, after the tap has been handled.
@nbradbury
nbradbury marked this pull request as ready for review August 4, 2026 13:05
@nbradbury
nbradbury requested review from dcalhoun and jkmassel August 4, 2026 13:09

@dcalhoun dcalhoun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changes fix the issue from my testing. However, the inline comment appears incorrect. We should address that.

The comment claimed onHidden stops a tap on the axis labels from
drilling into a stale bar. That premise is wrong: pointerPositionToX
maps only the pointer's x coordinate and ignores y, so the bottom-axis
labels sit under their bars and hit-test to a valid target. onShown
fires there like anywhere else in the box, with or without a prior
interaction.

Describe what actually happens instead. The onHidden reset stays -- it
still clears state that would otherwise outlive its gesture -- but it is
belt-and-braces, not what governs axis taps.
@nbradbury
nbradbury enabled auto-merge (squash) August 4, 2026 15:09
@nbradbury
nbradbury merged commit 6d9ff29 into trunk Aug 4, 2026
21 of 23 checks passed
@nbradbury
nbradbury deleted the issue/CMM-2198-new-stats-scrolling-changes-dates branch August 4, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants