sync theme

This commit is contained in:
Christoph Cullmann 2024-08-28 22:54:34 +02:00
parent 8db6bd0e55
commit 8f3d03b188
No known key found for this signature in database
53 changed files with 1747 additions and 213 deletions

View file

@ -46,10 +46,23 @@ class LiteYTEmbed extends HTMLElement {
this.addNoscriptIframe();
playBtnEl.removeAttribute('href');
// for the PE pattern, change anchor's semantics to button
if(playBtnEl.nodeName === 'A'){
playBtnEl.removeAttribute('href');
playBtnEl.setAttribute('tabindex', '0');
playBtnEl.setAttribute('role', 'button');
// fake button needs keyboard help
playBtnEl.addEventListener('keydown', e => {
if( e.key === 'Enter' || e.key === ' ' ){
e.preventDefault();
this.activate();
}
});
}
// On hover (or tap), warm up the TCP connections we're (likely) about to use.
this.addEventListener('pointerover', LiteYTEmbed.warmConnections, {once: true});
this.addEventListener('focusin', LiteYTEmbed.warmConnections, {once: true});
// Once the user clicks, add the real iframe and drop our play button
// TODO: In the future we could be like amp-youtube and silently swap in the iframe during idle time

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long