Conversation
…ontext loss - Extract shared analyzeFlashWindow() helper used by both FlashDetector and CSSFlashDetector, eliminating divergent inline counting logic - CSSFlashDetector now detects red flashes and classifies severity correctly via shared analysis path (previously hardcoded isRedFlash: false) - Add 4×4 region-based spatial analysis (8×8 pixel blocks) to catch localized flashes that average below threshold across the full frame, improving WCAG 2.3.1 spatial compliance - Handle canvas context loss gracefully — detector returns null from _sampleFrame when GPU context is reclaimed, resumes on restoration - Add 14 new tests covering all three fixes (84 total, 0 failures) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
analyzeFlashWindow()helper used by bothFlashDetectorandCSSFlashDetector, eliminating divergent inline counting logic. CSSFlashDetector now detects red flashes and classifies severity correctly (previously hardcodedisRedFlash: false).analyzeFrame().analyzeFlashWindow()checks each region independently on the slow path, catching localized flashes that average below the 0.1 threshold across the full frame — improving WCAG 2.3.1 spatial compliance.FlashDetectornow listens forcontextlost/contextrestoredevents._sampleFrame()returnsnullwhen GPU context is reclaimed, preventing silent analysis failure. Resumes automatically on restoration.Test plan
npm run validateclean (lint + tests)_sampleFrame🤖 Generated with Claude Code