• Hallo Frank,

    is there a chance to become YouTube Lyte embeds managed with the tab?

    I tried following Code-Snippets, but no chance:

    Theme: GeneratePress with GenerateBlocks

    Code in function.php from Childtheme:

    // Allow keyboard focus on Youtube Lyte
    add_filter( 'lyte_match_postparse_template', function( $lytetemplate ) {
    $lytetemplate = str_replace( ' class="lyte-wrapper">', ' class="lyte-wrapper" role="button" aria-label="play video" tabindex="0">', $lytetemplate );
    return $lytetemplate;
    });
    
    And two different tries of scripts in footer:
    
    the first for video:
    
    
    
    document.addEventListener('keydown', function(event) {
    if (event.key === 'Enter' || event.key === ' ') {
    var lyteWrapper = document.querySelector('.lyte-wrapper');
    if (lyteWrapper && document.activeElement === lyteWrapper) {
    lyteWrapper.click();
    }
    }
    });
    
    
    The second, to get the picture:
    
    document.addEventListener('keydown', function(event) {
        if (event.key === 'Enter' || event.key === ' ') {
            var lyteImage = document.querySelector('#lyte_sWNUYPekxT0'); // Nach ID suchen
            // oder
            // var lyteImage = document.querySelector('.pL'); // Nach Klasse suchen
            if (lyteImage && document.activeElement === lyteImage) {
                lyteImage.click();
            }
        }
    });
    
    But nothng works. Maybe you have an idea, how to get the videos accessible?
    
    thanks in advance, Stephan 
    
    

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, so it looks like the filter isn’t working as I don’t see the changes in the code ending up in the HTML of the linked page? Can you try adding the code using the code snippet plugin instead maybe? and add some error_log() statements and check the error-log to see if the filter is indeed being called upon?

Viewing 1 replies (of 1 total)
  • The topic ‘Keyboard Focus (accessibility)’ is closed to new replies.