Skip to content

Implements simple scroll progress tracking for safe html5 renderer#13983

Merged
rtibbles merged 4 commits intolearningequality:release-v0.19.xfrom
akolson:simple-scoll-progress
Jan 13, 2026
Merged

Implements simple scroll progress tracking for safe html5 renderer#13983
rtibbles merged 4 commits intolearningequality:release-v0.19.xfrom
akolson:simple-scoll-progress

Conversation

@akolson
Copy link
Copy Markdown
Member

@akolson akolson commented Dec 9, 2025

Summary

This PR implements scroll-based progress tracking for the SafeHTML5 viewer to more accurately measure user engagement with content. It also updates the scroll-completion threshold to account for real-world browser behavior, where scrolling often stops just short of the theoretical maximum (1 in our case)

References

Closes #13828

Reviewer guidance

  • Install the Safe Html5 plugin by running kolibri plugin enable kolibri.plugings.safe_html5_viewer
  • Run Kolibri and view HTML5 content
  • Ensure no regressions

@akolson akolson added this to the HTML5 Article Renderer milestone Dec 9, 2025
@akolson akolson requested a review from rtibbles December 9, 2025 13:23
@github-actions github-actions Bot added DEV: renderers HTML5 apps, videos, exercises, etc. DEV: frontend SIZE: small labels Dec 9, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 9, 2025

@rtibbles rtibbles self-assigned this Dec 11, 2025
Copy link
Copy Markdown
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Some thoughts on cleanup - I must admit, the duration based progress feels like something we can do further cleanup, outside of the scope of this PR too - I'll think on what that might look like!

Comment thread kolibri/plugins/safe_html5_viewer/assets/src/views/SafeHtml5RendererIndex.vue Outdated
Comment thread kolibri/plugins/safe_html5_viewer/assets/src/views/SafeHtml5RendererIndex.vue Outdated
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.

Could probably conditionalize this on this.forceDurationBasedProgress - if it's not set, we can just call recordProgress at the end of handleScroll?

@rtibbles rtibbles changed the base branch from develop to release-v0.19.x December 17, 2025 21:37
@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Jan 5, 2026

I am guessing the merge conflict here is just because of frontend folder refactor - I think a rebase onto release-v0.19.x should resolve this!

@akolson akolson force-pushed the simple-scoll-progress branch from bdec078 to 68654b4 Compare January 8, 2026 11:21
@akolson akolson requested a review from rtibbles January 8, 2026 12:20
@akolson
Copy link
Copy Markdown
Member Author

akolson commented Jan 8, 2026

@rtibbles I think we should be good with this?

},
},
async created() {
async mounted() {
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.

This is now deferring everything until mounted, when the only thing we need to defer until mounting is the tab indexes and the scroll listeners?

Thinking about it more, we're actually giving ourselves a potential race condition here by just waiting for next tick, because the point at which the ref will exist is not dependent on mounting, but rather when loading has been set to false.

I would revert this change from created to mounted, and move all of the things that are waiting on the next tick to another method:

async safeHtmlDomReadyHandler() {
   if (!this.loading) {
      await this.$nextTick();
      this.applyTabIndexes();
      window.addEventListener('resize', this.applyTabIndexes);
      this.setupScrollListener();
  }
},

then in the mounted hook, you would do this:

mounted() {
   this.safeHtmlDomReadyHandler();
   this.$watch('loading',this.safeHtmlDomReadyHandler);
},

This gives us the safety of the next tick, to make sure the effect of loading becoming false is propagated to the DOM, and if, for whatever reason it reloads, the watch statement will reapply these things for us.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes. I did encounter race conditions due to the above while testing with the created and mounted hooks. This seems reasonable direction. Thanks!

@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Jan 8, 2026

I made one more comment about the timing of manipulating/accessing the DOM (some of which was extant from the prior implementation) which would be good to get resolved.

It also looks like you have two stray commits from @AllanOXDi and one from @dependabot in this PR? Seems like the rebase has gone slightly awry.

@akolson
Copy link
Copy Markdown
Member Author

akolson commented Jan 8, 2026

Seems like the rebase has gone slightly awry.

Yes it appears the release and develop were out of sync! Any ideas on how this can be resolved @rtibbles?

Besides that, I think your comment has been successfully resolved.

@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Jan 8, 2026

I think doing git rebase --onto release-v0.19.x develop while on your feature branch should work, if it does not, you'll have to do an interactive rebase and manually drop the commits :)

@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Jan 8, 2026

Aside from the extraneous commits, code wise looks good to me - although I note there are failing tests - maybe need to be updated after the tweaks to the loading pattern?

@akolson
Copy link
Copy Markdown
Member Author

akolson commented Jan 8, 2026

yeah noticed this too! on it--thanks

@akolson akolson force-pushed the simple-scoll-progress branch 2 times, most recently from c75ab46 to 1d8aa10 Compare January 9, 2026 11:26
@akolson akolson requested a review from rtibbles January 9, 2026 15:37
@akolson
Copy link
Copy Markdown
Member Author

akolson commented Jan 9, 2026

That should resolve it for the misplaced commits I think, @rtibbles?

@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Jan 9, 2026

I am still seeing some commits that have @AllanOXDi and @marcellamaki's face on? But now they've been coauthored by you as well?

Should just be able to drop these commits entirely, because they're duplicates of ones that are already in the branch.

@akolson akolson force-pushed the simple-scoll-progress branch from 1d33724 to 548d8f0 Compare January 9, 2026 17:21
@github-actions github-actions Bot added DEV: dev-ops Continuous integration & deployment DEV: backend Python, databases, networking, filesystem... SIZE: large labels Jan 9, 2026
@akolson akolson force-pushed the simple-scoll-progress branch from 548d8f0 to 22d0a49 Compare January 9, 2026 17:24
@akolson
Copy link
Copy Markdown
Member Author

akolson commented Jan 9, 2026

@rtibbles dropped the commits, should be fine I think now!

@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Jan 9, 2026

A finely crafted commit history, I love to see it!

Copy link
Copy Markdown
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Code wise, this is looking excellent now - I just need to do a manual test locally before we hand over to QA for final checks.

@rtibbles
Copy link
Copy Markdown
Member

Local QA checks out - does exactly what it says on the tin. A more thorough check by the QA team definitely appreciated though!

@akolson akolson requested review from pcenov and radinamatic January 12, 2026 04:09
@radinamatic
Copy link
Copy Markdown
Member

Progress tracking through scrolling the page seems to be working correctly in all supported browsers in Windows and Ubuntu, and on the physical Android device.

I've updated the QA channel to include one long article to help with testing.

Copy link
Copy Markdown
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

LGTM, good to go! 💯 :shipit: 🚀

@rtibbles rtibbles merged commit 70d7bed into learningequality:release-v0.19.x Jan 13, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV: backend Python, databases, networking, filesystem... DEV: dev-ops Continuous integration & deployment DEV: frontend DEV: renderers HTML5 apps, videos, exercises, etc. SIZE: large SIZE: medium SIZE: small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Properly handle progress tracking based on scroll in the SafeHTML5Viewer

3 participants