- Moves `litegraphCanvas.getBoundingClientRect()` call outside the widget loop in `renderHtmlOverlays`.
- Reuses the `dpr` calculated at the top level.
- Adds regression test `tests/unit/MagnifyGlassRenderOptim.test.ts`.
Improves rendering performance by reducing forced reflows during magnification.
Add validation for all InfoPanel settings loaded in StateManager to prevent
injection of invalid values (e.g. out-of-bounds numbers, invalid colors).
This mitigates risks of degraded stability or potential injection via
manipulated settings storage.
- Add validateNumber, validateColor, validateStringOption helpers
- Update StateManager.loadSettings to validate all keys
- Add unit tests for validation logic
- Export form creation helpers for testing
- Add unique ID generation for sliders, selects, and color pickers
- Associate labels with inputs using `htmlFor`
- Add unit tests to verify accessibility attributes
- Pass event object to handleToggle from keydown listener
- Ensure stopPropagation() is called for keyboard events
- Maintain consistency between mouse and keyboard interaction behavior
- Update Require Alt Key toggle sync to include aria-checked attribute
- Update Reset Position button to clear aria-checked on Follow Cursor toggle
- Add regression tests for sidebar interaction state synchronization
- Add `role="switch"` and `aria-checked` to toggle elements
- Add `tabIndex="0"` for keyboard focus
- Add keyboard event listeners for Enter and Space keys
- Add `aria-labelledby` to associate toggles with their labels
- Enable toggling by clicking the label text
- Export `createToggle` for testing
- Add unit tests for accessibility and interaction logic
Reduces layout thrashing by filtering nodes based on their graph position before accessing their DOM widgets. This significantly improves performance on large graphs when using the magnifying glass.
- Calculates visible graph area based on cursor position and zoom.
- Checks intersection of node bounding box with visible area.
- Skips widget processing for off-screen nodes.
- Implement `validateNumber` and `validateColor` in `ConfigManager`.
- Clamp numeric settings (zoom, size, borders) to safe ranges.
- Validate color settings against hex regex.
- Update `ConfigManager` unit tests to cover validation logic.
This enhancement prevents invalid configuration states and potential stability issues caused by malformed or extreme setting values.
- Add `isHtml` flag to `Focus Node` button to bypass escaping
- Update `UIManager` to check for `isHtml` flag before formatting/escaping
- Add regression tests for trusted HTML rendering logic
Prevents excessive layout thrashing and calculations by syncing
updates to the browser's refresh rate.
- Wraps update logic in `EventHandler.ts` with `requestAnimationFrame`.
- Updates `lastKnownMousePosition` synchronously to ensure accuracy.
- Reduces CPU usage during rapid mouse movement.
- Properly cancels animation frame on cleanup.
- Updated `UIManager.createPanel` to call `updateMinimizedState()` if the panel is initialized in a minimized state.
- This ensures the `aria-expanded` attribute on the minimize button correctly reflects the initial state (false) instead of defaulting to true.
- Add `escapeHtml` utility to `src/shared/utils.ts`
- Sanitize rendered values in `src/info-panel/ValueFormatter.ts`
- Sanitize node titles, types, and labels in `src/info-panel/UIManager.ts`
- Add unit tests verifying XSS prevention in `tests/unit/Security.test.ts`
Prevents excessive layout thrashing and calculations by syncing
updates to the browser's refresh rate.
- Wraps update logic in `EventHandler.ts` with `requestAnimationFrame`.
- Updates `lastKnownMousePosition` synchronously to ensure accuracy.
- Reduces CPU usage during rapid mouse movement.
- Added `aria-label` to all icon-only buttons in the Info Panel and Magnify Glass toggle.
- Implemented dynamic `aria-pressed` state updates for toggle buttons (pin, lock, persist, etc.).
- Added `aria-expanded` state for the minimize/maximize button.
- Added `aria-label` to the copy-to-clipboard button.
- Ensures better screen reader compatibility and accessibility compliance.
Removes the `forceHideInfoPanel` method and its related helper methods (`removeForceHide`, `ensureForceHideCssRule`) from `MagnifyGlass.ts`. This workaround manually manipulated the DOM to hide the info panel, bypassing the intended state management via the `InfoPanel` class which hooks into `MagnifyGlass` visibility changes.
Testing:
- Verified that `MagnifyGlass.ts` compiles without errors.
- Verified that unit tests pass.
- Verified that `InfoPanel` logic correctly handles hiding via `hookIntoMagnifyGlass`.
Removed 'FIX:' prefix from comments in UIManager.ts as the logic
to prevent bouncing in Sticky Mode is already correctly implemented.
The comments now accurately describe the existing behavior without
implying a pending task.