Well, that was easy. leaving here if someone stumbles upon this and it’s useful OR if someone has a better solution. In the comments below – the first if statement designates we only want this to apply to our mega menu which in our case is menu-2 in theme_location of wp_nav_menu
// ADD SUBMENU BUTTON FOR A11Y
add_filter('walker_nav_menu_start_el', 'test_menu_arrow', 10, 4);
function test_menu_arrow($item_output, $item, $depth, $args) {
// ** The next 2 lines are the UPDATE see notes **
if ( empty( $args->theme_location ) || 'menu-2' !== $args->theme_location ) {
return $item_output;
}
if (in_array('menu-item-has-children', $item->classes)) {
$aria_label = $item->title;
$aria_controls = $item->ID;
$arrow = '<button class="sub-menu-btn" aria-expanded="false" aria-controls="sub-menu-'.$aria_controls.'" aria-label="More '.$aria_label.'"></button>';
$item_output = str_replace('</a>', '</a>'. $arrow .'', $item_output);
}
return $item_output;
}