Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.19 - Preload Fonts - Beacon processing part #7241

Open
piotrbak opened this issue Jan 26, 2025 · 2 comments · Fixed by wp-media/rocket-scripts#42 or #7316
Open

3.19 - Preload Fonts - Beacon processing part #7241

piotrbak opened this issue Jan 26, 2025 · 2 comments · Fixed by wp-media/rocket-scripts#42 or #7316
Assignees
Labels
effort: [M] 3-5 days of estimated development time effort: [S] 1-2 days of estimated development time
Milestone

Comments

@piotrbak
Copy link
Contributor

User Story
As a system, I‘d like to gather eligible fonts from the accessed page

Acceptance Criteria

  • Eligible fonts are:
    • custom fonts (not system fonts) that have a non-zero width and height, be visible (not opacity 0, display none, or visibility hidden)
    • these font types by default: woff2, woff, ttf
    • fonts using @import
    • pseudo elements before/after used by font icons (need to estimate the effort to possibly remove it from the pre-alpha)
    • font weight/style pairings as they might have different fonts
    • When WPR debug is enabled, preloaded fonts are logged into the console (to make it testable)
@piotrbak piotrbak added this to the 3.19-prealpha milestone Jan 26, 2025
@piotrbak piotrbak changed the title 3.19 - Beacon processing part 3.19 - Preload Fonts - Beacon processing part Jan 26, 2025
@jeawhanlee
Copy link
Contributor

Scope a solution ✅

  • Create a new js file to hold the preload font beacon ( BeaconPreloadFonts )
  • Pass the Logger class as a dependency.
  • Create a new method to getResults() from the scan method, this method will return results using the highlight method by passing ('above-fold')
  • Add logs of the results using this.logger.logMessage coming from the logger dependency.
  • In https://github.com/wp-media/rocket-scripts/blob/develop/src/BeaconManager.js, instantiate the new class with the Logger class with a call to the scan method.
  • Add basic tests

The prototype can be found here

We might need to check if the logic will work with the current way our event listener is set up here as the one on the prototype is async and load event.

Estimate the effort ✅

[S - M]

@wordpressfan
Copy link
Contributor

Looks good to me.

We also need to check the output of prototype and see how it works for custom and system fonts (maybe fonts without urls are considered system fonts), also need to see what happens when we have a font usage without definition.

@piotrbak piotrbak added effort: [S] 1-2 days of estimated development time effort: [M] 3-5 days of estimated development time labels Feb 6, 2025
@jeawhanlee jeawhanlee self-assigned this Feb 11, 2025
@Mai-Saad Mai-Saad self-assigned this Feb 20, 2025
@jeawhanlee jeawhanlee linked a pull request Feb 20, 2025 that will close this issue
11 tasks
Khadreal added a commit that referenced this issue Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: [M] 3-5 days of estimated development time effort: [S] 1-2 days of estimated development time
Projects
None yet
4 participants