-
Notifications
You must be signed in to change notification settings - Fork 108
[MBL-19610][Teacher][Parent] Fix dark/light mode theme state on rotation for HTML content #3464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
This PR adds a call to handleConfigurationChange(reloadContent = true) in the onRestoreInstanceState method to reload content with the restored theme after state restoration.
Potential Issues Found
- WebView content reload side effects (line 198): Reloading WebView content during state restoration may cause lost scroll position, duplicate loads, and performance impact. Consider if
reloadContent = falsewould suffice or if scroll position preservation is needed.
Positive Aspects
✅ Preserves theme state: The change ensures that the themeSwitched state is properly applied when the view is restored
✅ Clean implementation: The code reuses the existing handleConfigurationChange method rather than duplicating logic
✅ Proper state restoration: Both themeSwitched and html are correctly restored from the saved state
Questions
Could you provide context on what specific issue this fixes? Understanding the root cause would help evaluate if this is the most appropriate solution or if there are alternatives that avoid the WebView reload side effects.
Code Quality
The code follows Kotlin conventions and integrates well with the existing codebase. The change is minimal and focused, which is good for maintainability.
libs/pandautils/src/main/java/com/instructure/pandautils/views/CanvasWebViewWrapper.kt
Show resolved
Hide resolved
📊 Code Coverage Report✅ Student
✅ Teacher
✅ Pandautils
📈 Overall Average
|
🧪 Unit Test Results✅ 📱 Student App
✅ 📱 Teacher App
✅ 🌅 Horizon
✅ 📦 Submodules
📊 Summary
Last updated: Mon, 05 Jan 2026 15:57:33 GMT |
adamNagy56
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA +1
kdeakinstructure
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA 👍
Summary
Fixed dark/light mode theme state preservation during screen rotation for HTML content views. When users switched the theme in WebView content and rotated the device, the theme would reset to default. This is now fixed for most HTML content fragments.
Changes
Limitations
The following scenarios remain unfixed due to ViewPager architectural constraints:
These cases would require significant architectural changes (retaining fragment instances or global theme state management) which are beyond the scope of this fix.
Test Plan
Fixed Scenarios ✓
Test Case 1: Global Announcement (Teacher Dashboard)
Test Case 2: Terms of Use (Parent App)
Known Limitations (Unchanged)⚠️
Scenario 1: Syllabus
Scenario 2: Module Pages
refs: MBL-19610
affects: Teacher, Parent
release note: Fixed dark/light mode theme preservation during screen rotation for HTML content pages
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com