Skip to content

perf: optimize zoom overlay component to reduce DOM queries#7401

Open
lavjeetrai wants to merge 1 commit into
sugarlabs:masterfrom
lavjeetrai:feature/optimize-zoom-overlay
Open

perf: optimize zoom overlay component to reduce DOM queries#7401
lavjeetrai wants to merge 1 commit into
sugarlabs:masterfrom
lavjeetrai:feature/optimize-zoom-overlay

Conversation

@lavjeetrai
Copy link
Copy Markdown

This PR optimizes the zoom overlay component to reduce DOM queries and improve performance.

Because zooming typically fires many rapid events in succession, removing repetitive DOM querying, element creation, and CSS parsing significantly reduces overhead and prevents UI lag. The function now only updates the text percentage and opacity on subsequent calls.

Details:

  • JavaScript Optimization (js/utils/zoomOverlay.js): Refactored the overlay logic to cache the DOM element and timeout ID using module-scoped variables. This eliminates the need to call document.getElementById every time the overlay updates, improving overall performance during zoom actions.

Labels:

  • Performance
  • Documentation

@github-actions github-actions Bot added performance Improves performance (load time, memory, rendering) size/M Medium: 50-249 lines changed area/javascript Changes to JS source files labels May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🧪 Jest Test Results

✅ All Jest tests passed! This PR is ready to merge.

Coverage: Statements: 46.9% | Branches: 38.37% | Functions: 51.3% | Lines: 47.33%
Master Coverage: Statements: 48.11% | Branches: 39.52% | Functions: 52.84% | Lines: 48.52%

@lavjeetrai lavjeetrai mentioned this pull request May 20, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/javascript Changes to JS source files performance Improves performance (load time, memory, rendering) size/M Medium: 50-249 lines changed

Projects

Development

Successfully merging this pull request may close these issues.

1 participant