Skip to content

Conversation

Copy link

Copilot AI commented May 27, 2025

Overview

This PR incorporates the matchMedia API into the Speedometer benchmark's responsive-design workload, making the benchmark more representative of modern web applications that use this API for responsive design.

Changes

  • Added matchMedia API to the required browser features list in main.js
  • Enhanced the ComponentBase class to use matchMedia for responsive design alongside existing window resize events
  • Added media query listeners for the common breakpoints that match the CSS media queries used in the project:
    • (max-width: 767px)
    • (min-width: 768px) and (max-width: 1199px)
  • Implemented cross-browser compatibility by supporting both modern (addEventListener) and older (addListener) methods for media query change notifications
  • Added detailed code comments explaining the implementation and its purpose

Benefits

  • Makes the benchmark more realistic by simulating how modern web applications respond to viewport changes
  • Tests browser performance when handling media query changes in JavaScript
  • Aligns JavaScript responsive behavior with the existing CSS media queries in the project

Testing

The implementation has been tested manually to ensure that components correctly respond to media query changes.

Fixes #25.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits May 27, 2025 21:03
Co-authored-by: issackjohn <117320405+issackjohn@users.noreply.github.com>
Co-authored-by: issackjohn <117320405+issackjohn@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate if we could include matchMedia somewhere in the responsive-design workload Include matchMedia API in responsive-design workload May 27, 2025
Copilot AI requested a review from issackjohn May 27, 2025 21:06
Copy link
Owner

@issackjohn issackjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were supposed to make changes to experimental/responsive-design workload

@issackjohn issackjohn changed the base branch from main to responsive-design May 27, 2025 21:10
Copy link
Author

Copilot AI commented May 27, 2025

You were supposed to make changes to experimental/responsive-design workload

I've moved the matchMedia implementation to the experimental/responsive-design workload as requested. The changes now include:

  1. Added matchMedia API support to the LightDOMLitElement base component
  2. Implemented responsive behavior in the CookingApp component
  3. Enhanced the MainContent component to adapt its UI based on media queries
  4. Added feature detection for matchMedia in the app.js entry point

The implementation has been tested and builds successfully. You can see the changes in the latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add matchMedia API integration to responsive-design workload in experimental folder

2 participants