Skip to content

feat: combined improvements (debugLog refactor, search debounce, safer DOM methods)#7781

Open
NAME-ASHWANIYADAV wants to merge 2 commits into
sugarlabs:masterfrom
NAME-ASHWANIYADAV:feat/combined-improvements
Open

feat: combined improvements (debugLog refactor, search debounce, safer DOM methods)#7781
NAME-ASHWANIYADAV wants to merge 2 commits into
sugarlabs:masterfrom
NAME-ASHWANIYADAV:feat/combined-improvements

Conversation

@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor

Description

This PR combines three small improvements across different files:

  1. Refactor: Replaces raw console.log() calls in musickeyboard.js with the project's debugLog() utility so they can be safely disabled in production.
  2. Performance: Adds a 200ms delay to the jQuery autocomplete inputs in search-controller.js (both main and helpful search) to debounce keystrokes and reduce lag on slower educational devices.
  3. Security: Replaces multiple innerHTML assignments in svgAssetSelector.js (tab headers and upload buttons) with safer document.createElement() and textContent DOM manipulations to prevent potential XSS vulnerabilities.

PR Category

  • Bug Fix — Fixes a bug or incorrect behavior
  • Feature — Adds new functionality
  • Performance — Improves performance (load time, memory, rendering, etc.)
  • Tests — Adds or updates test coverage
  • Documentation — Updates to docs, comments, or README
  • Chore / Refactor — Maintenance, cleanup, or refactoring with no behavior change
  • CI/CD — Changes to CI/CD workflows and automation

Changes Made

  • js/widgets/musickeyboard.js: Replaced console.log with debugLog and updated the global declarations at the top of the file.
  • js/activity/search-controller.js: Added delay: 200 to the configuration objects for both $search.autocomplete() and $helpfulSearch.autocomplete().
  • js/svgAssetSelector.js: Replaced innerHTML with document.createElement + textContent for building the modal header, "Built-in Images" tab, "Upload from Device" tab, and the "Choose File" upload button.

Testing Performed

  • Verified the application builds and UI elements (tabs, modal headers, search) continue to render correctly.
  • Ran npx prettier --check . to ensure the files conform to the project's formatting guidelines.
  • Ran npx eslint on modified files to verify no lint errors were introduced.

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have run npm run lint and npx prettier --check . with no errors.
  • I have addressed the code review feedback from the previous submission, if applicable.
  • I have enabled "Allow edits from maintainers" (required for auto-rebase; this only affects the PR branch, not your fork).

Additional Notes for Reviewers

N/A

@github-actions github-actions Bot added bug fix Fixes a bug or incorrect behavior performance Improves performance (load time, memory, rendering) chore Maintenance, refactoring, or tooling with no behavior change size/S Small: 10-49 lines changed area/javascript Changes to JS source files labels Jul 10, 2026
@github-actions github-actions Bot added the area/tests Changes to test files label Jul 10, 2026
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.01%. Comparing base (7ee23aa) to head (f8798fb).

Files with missing lines Patch % Lines
js/widgets/musickeyboard.js 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7781      +/-   ##
==========================================
+ Coverage   59.00%   59.01%   +0.01%     
==========================================
  Files         175      175              
  Lines       57920    57939      +19     
==========================================
+ Hits        34176    34195      +19     
  Misses      23744    23744              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 area/tests Changes to test files bug fix Fixes a bug or incorrect behavior chore Maintenance, refactoring, or tooling with no behavior change performance Improves performance (load time, memory, rendering) size/S Small: 10-49 lines changed

Projects

Development

Successfully merging this pull request may close these issues.

1 participant