Skip to content

Track Responsive-Design carousel ResizeObserver event counts #54

@issackjohn

Description

@issackjohn

Follow-up from WebKit#453 review.

Review context:

Current state:

  • experimental/responsive-design/src/lib/components/recipe-carousel.js uses ResizeObserver to update _carouselWidth, which affects _getItemsPerView() and carousel scroll distance.
  • Other Responsive-Design components also intentionally use browser-observable responsive APIs:
    • app-ribbon.js uses ResizeObserver for visible button count.
    • information-window.js uses ResizeObserver.
    • recipe-grid.js uses matchMedia("(max-width: 640px)") and emits resize-work-complete for benchmark synchronization.
  • The benchmark resize steps wait for one resize-work-complete event from recipe-grid, but they do not verify how many ResizeObserver callbacks fire in recipe-carousel or whether the count is consistent across browsers.

Problem to investigate:

  • ResizeObserver callback counts can differ by browser or layout timing.
  • If recipe-carousel sees a different number of resize notifications, the workload may do inconsistent responsive work even when the benchmark still completes.

Suggested direction:

  • Track the number of ResizeObserver notifications in recipe-carousel during ReduceWidthIn5Steps and IncreaseWidthIn5Steps.
  • Decide whether this should be:
    • a diagnostic console.warn when counts differ from expected values, or
    • a strict unittest/e2e assertion if the expected count is stable across Safari, Chrome, Firefox, and Edge.
  • If strictness is too brittle, expose a debug counter and validate only coarse invariants, e.g. callbacks occurred and final _carouselWidth matches the final iframe width class/threshold.
  • Keep benchmark measurement boundaries unchanged unless the count tracking shows missing async work.

Validation:

  • Run Responsive-Design across the browser matrix and compare observed ResizeObserver counts.
  • Add a unit/e2e test only after expected browser behavior is confirmed stable enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions