Page profiler extrapolates inaccurate responsive slot widths from one viewport measurement
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- javascript, php
- 領域
- frontend, performance
調査の方向性
assets/js/modules/srcset-detector.js の _generateResponsiveSizes() から始め、続いて記載されている PHP ファイル内の Profile::store() と add_missing_srcset_attributes() を追跡します。JavaScript の srcset-detector スイートと tests/test-srcset.php を実行し、その後、デスクトップとモバイルのブレークポイント間で比率が変化するレイアウト全体について、生成されたサイズを測定済みの CSS スロットと照合します。
索引モデルが issue の本文から書いたものです。
説明
Summary
Optimole-generated sizes values can overstate an image's slot width at responsive breakpoints because the observed layout width from one viewport is projected onto other viewport sizes. The generated slot values are expected to reflect the image's responsive CSS layout. On layouts whose width proportion changes by breakpoint, the generated value can cause the browser to select a substantially oversized image and increase mobile transfer and rendering cost.
Customer context
Product / area: Optimole page profiler and generated sizes attributes
Version: Customer version not provided; inspected source is v4.2.10
Environment: Responsive WordPress frontend, including a 360-pixel mobile viewport
Integration / third party: Browser responsive-image selection
Reported error / symptom: A full-bleed hero reportedly received a 614-pixel slot declaration on a 360-pixel viewport and selected a 2386-pixel image
Impact: Oversized mobile image downloads and degraded performance on an image-heavy site.
Reproduction notes
The transcript provides a staff-confirmed output example; no local runtime reproduction was performed.
- Use a responsive image whose slot occupies a different proportion of viewport width on desktop and mobile.
- Allow the desktop page profiler to record missing srcset data.
- Load a later response at a mobile breakpoint and inspect the generated
sizesvalue. - Compare the declared slot with the rendered CSS width and selected resource. The report observed a 614-pixel declaration on a 360-pixel viewport.
Diagnosis
Conclusion
The profiler observes the image width at the current viewport, converts it to one viewport-width ratio, and applies that ratio to every fixed breakpoint. It has no measurement of how the image's CSS slot changes at those breakpoints. Only desktop missing-srcset measurements are stored globally, so a mobile profile does not correct this projection. This directly supports the reported inaccurate mobile slot for responsive layouts whose proportions change.
Where this likely occurs
assets/js/modules/srcset-detector.js—optmlSrcsetDetector._calculateRequiredSizes()lines 341–362 delegates responsive inference to_generateResponsiveSizes().assets/js/modules/srcset-detector.js—optmlSrcsetDetector._generateResponsiveSizes()lines 410–483 calculatescurrentWidth / window.innerWidthonce and projects that ratio across all configured breakpoints.inc/v2/PageProfiler/Profile.php—OptimoleWP\PageProfiler\Profile::store()lines 183–209 stores missing-srcset measurements in global profile data only for the desktop device profile.inc/tag_replacer.php—Optml_Tag_Replacer::add_missing_srcset_attributes()lines 487–578 converts the projected breakpoint data into renderedsizesclauses.- Commit
49a757f34fd1introduced the current single-ratio breakpoint projection; it is present from v4.1.0 through inspected v4.2.10.
Engineering notes
The observed ratio is accurate only while the image occupies the same proportion of viewport width at every generated breakpoint. Responsive layout transitions, fixed-width components, column changes, and breakpoint-specific CSS can violate that assumption. The inspected JavaScript parses existing srcset candidates but does not use an existing sizes expression as a responsive layout model. Existing lowercase calc(), min(), max(), and clamp() values intentionally bypass sizes enhancement through Optml_Tag_Replacer::should_skip_sizes() at inc/tag_replacer.php lines 686–713; this confirms the customer's workaround uses a deliberate guard.
Test coverage status
assets/js/modules/__tests__/srcset-detector.test.js covers candidate parsing, validation, and selection but no direct test of _generateResponsiveSizes() across layouts with different desktop and mobile slot proportions was found. tests/test-srcset.php lines 112–169 tests rendering from supplied candidate data and assumes the profiler data is accurate. Tests were not executed during this read-only investigation.
What to verify or explore next
- Reproduce with a layout whose image changes from one desktop-width proportion to a different mobile-width proportion.
- Capture profiler payloads and rendered
sizesoutput from desktop and mobile profiling passes. - Compare browser-selected resources against measured CSS slots at the configured breakpoints.
- Run the JavaScript
srcset-detectorsuite and PHP srcset suite.
Unknowns / follow-up
The customer's exact CSS layout, cache state, and plugin version are unavailable. The report's 614-pixel value was not regenerated locally.
Confidence
Confidence: 95/100
Repository inspection confirms three independently verifiable defects in Optimole's page-profiler responsive-image path, and no matching GitHub issues were found. The reported Retina-disabled 1x behavior is intentional setting behavior covered by tests, so it is not included as a defect.
Source: HelpScout #3424946418
Generated by bug-report-triage (ID: bug-report-triage_6a87087cc5e402.90677248)
- 主要言語
- PHP
- スター
- 73
- フォーク
- 14
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Codeinwp/optimole-wp のほかの issue
-
bug-report bug-report-triage crash-report
難易度 4/5 3〜5日 初心者へのやさしさ 65/100
Codeinwp/optimole-wp#1162 ·
メンテナーはふだん 1 日以内に返信
-
customer report feature-request-triage
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
Codeinwp/optimole-wp#1161 ·
メンテナーはふだん 1 日以内に返信
-
bug-report bug-report-triage customer report regression
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
Codeinwp/optimole-wp#1159 ·
メンテナーはふだん 1 日以内に返信
-
customer report feature-request-triage
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
Codeinwp/optimole-wp#1151 ·
メンテナーはふだん 1 日以内に返信
-
bug-report bug-report-triage crash-report
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
Codeinwp/optimole-wp#1139 ·
メンテナーはふだん 1 日以内に返信
Codeinwp/optimole-wp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
521xueweihan/HelloGitHub#3790 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
benjaminkott/bootstrap_package#1670 ·
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信