docs: note device-pixel vs CSS-pixel mismatch in screenshots#201
Open
sauravpanda wants to merge 1 commit intomainfrom
Open
docs: note device-pixel vs CSS-pixel mismatch in screenshots#201sauravpanda wants to merge 1 commit intomainfrom
sauravpanda wants to merge 1 commit intomainfrom
Conversation
capture_screenshot() saves PNGs at device pixels, but click_at_xy() takes CSS pixels. On a HiDPI / Retina display that's a 2x factor — reading a coordinate off the screenshot and clicking it directly misses by half. Document the conversion in interaction-skills/screenshots.md and add a docstring to click_at_xy pointing at it.
✅ Skill review passedReviewed 1 file(s) — no findings. |
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
capture_screenshot()writes PNGs at device pixels butclick_at_xy()takes CSS pixels — on a 2x display, reading a coordinate off the image and clicking it directly misses by half.interaction-skills/screenshots.mdwith the conversion recipe and the discovery-vs-verification distinction, and add a docstring toclick_at_xypointing at it.Verification
Confirmed the gap empirically before writing the doc:
Then dropped a 60×60 button at CSS (180,180) and clicked twice:
click_at_xy(210, 210)→ click registered (CSS coord inside button) ✅click_at_xy(420, 420)→ no click (device-pixel coord, lands well outside) ❌So
click_at_xydefinitively takes CSS pixels, and the previousscreenshots.md(one sentence) didn't say so.Test plan
browser-harness -c "print(click_at_xy.__doc__)"shows the new docstringpage_info()still worksinteraction-skills/screenshots.mdfor tone/scopeSummary by cubic
Clarify the device‑pixel vs CSS‑pixel mismatch between
capture_screenshot()andclick_at_xy(), and add a docstring that points to a short conversion recipe ininteraction-skills/screenshots.md. This prevents off‑by‑DPR clicks on HiDPI/Retina displays and explains when to use full‑page vs viewport screenshots.Written for commit dcd8137. Summary will update on new commits.