Skip to content

chore: use events as trigger to load delayed.js#408

Draft
davidnuescheler wants to merge 3 commits intomainfrom
interaction-trigger-delayed
Draft

chore: use events as trigger to load delayed.js#408
davidnuescheler wants to merge 3 commits intomainfrom
interaction-trigger-delayed

Conversation

@davidnuescheler
Copy link
Copy Markdown
Contributor

in some situations it is desirable to load delayed on an earlier trigger than a specified timeout.

https://interaction-trigger-delayed--aem-boilerplate--adobe.aem.page/

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync bot commented Oct 2, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync bot commented Oct 2, 2024

Page Scores Audits Google
📱 / PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ / PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@davidnuescheler
Copy link
Copy Markdown
Contributor Author

this is likely to be obsoleted when #376 is merged

@freshjones
Copy link
Copy Markdown

@davidnuescheler this looks/works great, just have a couple questions:

  1. since it seems like boilerplate is headed more in the direction of chore: change from delayed flow to include consent #376 should we wait for that to get merged before considering this approach for our sites? I think our goal is to try and remain as aligned w the Adobe boilerplate approach as much as we can.

  2. if we do use this approach is there any value in adding event listeners for additional events beyond scroll? e.g.
    'mousemove',
    'touchstart',
    'keydown',
    'click',
    'touchmove',

    thanks!

@davidnuescheler
Copy link
Copy Markdown
Contributor Author

@freshjones thanks a lot for the input... very helpful.

(1) i think that's definitely true that these are competing and i don't know what the merge schedule of either of them are, but it is definitely a good idea to keep an eye on them. even after we merge #376 i would expect people to still use the traditional loading sequence as well, so this is truly just a recommended template.

(2) i think that projects are welcome to add other events, but i found the list somewhat arbitrary, so i didn't want to include and maintain a large set of event here, but i would expect projects to be able add more events based on their specific needs and uses.

@fkakatie
Copy link
Copy Markdown
Member

fkakatie commented Feb 3, 2026

@davidnuescheler - FYI: I just updated loadDelayed() with multiple interaction triggers and duplicate import guards. And updated to main.

#376 removes loadDelayed() entirely for consent flow, which conflicts (obviously, discussed above). Worth considering whether consent should also wait for interaction vs. immediate load. And which PR to move forward with, if any.

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.

3 participants