Debug, optimize perf & a11y, complete gesture stubs#2
Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Open
Debug, optimize perf & a11y, complete gesture stubs#2devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
- Lint: scope root prettier/eslint so they skip the separate site/htdocs workspace and generated partytown vendor files; root lint now runs cleanly end to end. - ScreenReader: initialize speaking flag, coalesce rapid duplicate announcements to reduce TTS churn and avoid flooding the user. - Emoji/symbol translation: precompile a single sorted regex per map so calls are O(n) instead of O(n*k), sort keys by length so multi-char emoji (e.g. ❤️, ❤️🔥) match before their prefixes, and coerce input to string defensively. - Page/Widget interceptors: cap the 'waiting for globals' retry loop at ~5s so a missing Page/createWidget no longer produces an endless 100ms timer chain on unsupported devices. - NavigationManager: fix the word/sentence/paragraph cursor so it jumps by real word offsets and gracefully handles empty text instead of silently skipping elements. - Gesture stubs: implement scroll_up / scroll_down (focus navigation parity with scrolling), previous_page (router.back), and next_page (configurable router.push with a spoken fallback when none is set). - SoundFeedback: hoist the sound map to a module-level constant and detach stale PREPARE listeners between plays so rapid-fire cues do not leak handlers on the media player. - SpeechHistory: coalesce back-to-back duplicate entries with a count so the history log stays readable and doesn't push real content out of the 50-entry buffer on repeated focus events. Co-Authored-By: Coding Nguyen <Quang.hnm.hd.2k@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Deploying zepp-reader with
|
| Latest commit: |
1b1e671
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://676552b5.zepp-reader.pages.dev |
| Branch Preview URL: | https://devin-1776438923-debug-perf.zepp-reader.pages.dev |
Devin Review flagged that the refactored applyReplacer dropped the commas that the original translateEmojis/translateSymbols wrapped around each spoken description. Commas matter for TTS engines because they introduce a short pause, so for a11y users the announcement 'I love you ❤️ so much' must render as 'I love you , Red heart, so much' rather than collapsing into a single run-on phrase. Co-Authored-By: Coding Nguyen <Quang.hnm.hd.2k@gmail.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
Cross-cutting debug / perf / a11y / feature-completion pass over the ZSR core library, driven by a walkthrough of
lib/core,lib/feedback,lib/interactionandlib/utils..prettierignoreandeslint.config.mjsnow scope root lint to actual project sources: the separatesite/htdocsSvelteKit workspace, generated~partytownvendor files,dist/,node_modules/and.cache/are ignored.npm run lintis now green from the repo root.speakingis initialized in the constructor, and rapid duplicate non-high-priority announcements within 500ms are coalesced, so focus / event retries don't re-queue identical TTS items.translateEmojis/translateSymbolsnow precompile a single alternation regex per map, sort keys by length so multi-codepoint sequences (e.g.❤️,❤️🔥) match before their prefixes, escape special regex chars for the symbol table, and defensively coerce input to string. This turns each call from O(n·k) regex builds into a single O(n) pass.PageInterceptorandWidgetInterceptorboth cap their "wait for global" retry chain at ~5s (50 × 100ms) and log an error instead of spinning forever on devices wherePage/createWidgetis never exposed.wordmode rebuilds words via/\S+/gwith real offsets so the cursor jumps accurately across punctuation/whitespace gaps;sentence/paragraphmodes and empty-text paths now announce gracefully instead of silently no-oping.scroll_up/scroll_downnow translate into focusprev/next(the accessible analogue of scrolling),previous_pagecalls@zos/router.back(), andnext_pageeither pushes a configurableScreenReaderConfig.nextPageUrlor announces that no next page is available.PREPARElistener is detached betweenplay()calls to avoid leaking handlers on rapid-fire cues.count, so the 50-entry buffer stays useful instead of being pushed out by repeated focus events.Smoke-tested
lib/utils/emojis.jsandlib/utils/speechHistory.jsunder Node 22.13.0;npm run lintpasses.Review & Testing Checklist for Human
Risk: yellow — touches hot paths (TTS queue, navigation cursor, gesture dispatch) but no API changes.
scroll_up/scroll_down/next_page/previous_pagebehave sensibly — in particular confirmprevious_pageactually calls@zos/router.back()on your page stack.wordreading mode; verify the cursor lands on each real word and doesn't get stuck mid-sentence.❤️and❤️🔥are spoken as a single phrase (not a heart followed by an orphan variation selector).Notes
site/htdocs/**was deliberately excluded from root lint rather than auto-formatted — it has its own workspace and its own Prettier/ESLint setup, and reformatting it from the root would produce a huge unrelated diff.npm testis the placeholderexit 1); verification relied on module smoke tests and manual reading.Link to Devin session: https://app.devin.ai/sessions/acb85709db3d477e8fc61dbc490e7145
Requested by: @NVCDevelopmentTeam