Skip to content

GH#1235: fix: guard scrollIntoView against missing elements#1243

Merged
superdav42 merged 1 commit into
mainfrom
feature/auto-20260520-190804-gh1235
May 21, 2026
Merged

GH#1235: fix: guard scrollIntoView against missing elements#1243
superdav42 merged 1 commit into
mainfrom
feature/auto-20260520-190804-gh1235

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

@superdav42 superdav42 commented May 21, 2026

Summary

Added null-check guard for document.getElementById() result before calling scrollIntoView() in the scroll_to method. This prevents TypeError when an element with the given ID is not found.

Files Changed

assets/js/checkout-forms-editor.js

Runtime Testing

Resolves #1235


aidevops.sh v3.17.14 plugin for OpenCode v1.15.6 with claude-haiku-4-5 spent 59s and 2,348 tokens on this as a headless worker.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where the editor could crash when attempting to scroll to missing or unavailable elements. The component now safely handles cases where target elements don't exist on the page.

Review Change Stack

- Add null-check before calling scrollIntoView() in scroll_to method
- Prevents TypeError when element with given ID is not found
- Resolves issue #1235 from PR #1222 review feedback
@superdav42 superdav42 added the origin:worker Auto-created by pulse labelless backfill (t2112) label May 21, 2026
@superdav42
Copy link
Copy Markdown
Collaborator Author

Completion Summary


aidevops.sh v3.17.14 plugin for OpenCode v1.15.6 with claude-haiku-4-5 spent 1m and 2,348 tokens on this as a headless worker.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b7093993-6ba9-4f7d-bef1-7e74acf7a066

📥 Commits

Reviewing files that changed from the base of the PR and between 5220fa6 and d9fa228.

📒 Files selected for processing (1)
  • assets/js/checkout-forms-editor.js

📝 Walkthrough

Walkthrough

The scroll_to method in the Vue editor component is updated to guard against missing DOM elements before calling scrollIntoView. The change adds a null check so the method silently returns when an element cannot be found, rather than throwing an error.

Changes

Scroll-to method guard

Layer / File(s) Summary
Scroll-to guard against missing elements
assets/js/checkout-forms-editor.js
The scroll_to(element_id) method now checks if (element) before calling scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' }), preventing runtime errors when the element does not exist in the DOM.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

review-feedback-scanned, origin:interactive

Poem

🐰 A guard clause stands tall and true,
Before scrolling into view—
No null reference shall pass,
Safe and smooth, the method's task! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a null-check guard for scrollIntoView.
Linked Issues check ✅ Passed The PR implements the exact fix specified in issue #1235: guarding scrollIntoView with an if (element) check.
Out of Scope Changes check ✅ Passed All changes directly address the null-check requirement from issue #1235; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/auto-20260520-190804-gh1235

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit dcdb8da into main May 21, 2026
11 checks passed
@superdav42
Copy link
Copy Markdown
Collaborator Author

Completion Summary


aidevops.sh v3.17.14 plugin for OpenCode v1.15.6 with claude-haiku-4-5 spent 1m and 2,348 tokens on this as a headless worker.


Merged via PR #1243 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).

@github-actions
Copy link
Copy Markdown

Performance Test Results

Performance test results for a97ef0f are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 41 37.78 MB 929.50 ms (-23.50 ms / -3% ) 166.00 ms (-14.00 ms / -8% ) 1120.00 ms 2110.00 ms 2027.65 ms 79.75 ms
1 56 49.13 MB 963.00 ms 154.00 ms 1117.50 ms 2154.00 ms 2077.60 ms 76.45 ms

@superdav42 superdav42 added the review-feedback-scanned Merged PR already scanned for quality feedback label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

origin:worker Auto-created by pulse labelless backfill (t2112) review-feedback-scanned Merged PR already scanned for quality feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quality-debt: assets/js/checkout-forms-editor.js — PR #1222 review feedback (high)

1 participant