What are some of your favorite methods for creating an accessible menu?

Kevin Leary posted a snippet to add aria-expanded tags in 2018. I love the simplicity of it.

He describes what we’re doing here:

This is the recommended approach for “fly-out (or drop-down) menus”
provided by the w3.org, more on fly-out menu accessibility can be read
on their site directly.

function my_nav_menu_link_attributes( $atts, $item, $args ) {
    if ( 'main' === $args->theme_location ) {
        $item_has_children = in_array( 'menu-item-has-children', $item->classes );
        if ( $item_has_children ) {
            $atts['aria-haspopup'] = 'true';
            $atts['aria-expanded'] = 'false';
        }
    }
    return $atts;
}
add_filter( 'nav_menu_link_attributes', 'my_nav_menu_link_attributes', 10, 3 );