Wrong current class on admin menu with add_submenu_page()

I rewrote the code:

/*
Plugin Name: Admin Menu Post List
Plugin URI:
Description: Display a simple post list in admin menu for easy access
Version: 0.2
Author: Eliot Akira
Author URI:
License: GPL2
*/


/*
 * Load CSS in header
 */

function custom_post_list_view_css() { ?>

        <style>
                .post_list_view_headline {
                        padding-left: 10px !important;
                        padding-right: 10px !important;
                }
                .post_list_view_post {
                        margin-left:12px;
                }
                .post_current a {
                        color:white !important;
                }
    </style>

<?php }
add_action( 'admin_head', 'custom_post_list_view_css' );


/*
 * Admin Menu Post List
 */


add_action('admin_menu', 'custom_post_list_view');
function custom_post_list_view() {

        /*** Get options ***/

        $post_types = array( 'post', 'page' );

        $current_post_ID = $_GET['post']; /* Get current post ID on admin screen */

        foreach ($post_types as $post_type) {

                $custom_menu_slug = $post_type;
                $output="";

                $args = array(
                        "post_type" => $post_type,
                        "parent" => "0",
                        "post_parent" => "0",
                        "numberposts" => "-1",
                        "orderby" => "menu_order",
                        "order" => "ASC",
                        "post_status" => "any",
                        "suppress_filters" => 0
                );

                $posts = get_posts($args);

                if($posts) {

                        $output .= '</a>';

                        $output .= '<div class="list_view_' . $post_type . '">'
                                                . '<div class="post_list_view_headline">' . '<hr>' . '</div>';
                        foreach ($posts as $post) {
                                $edit_link = get_edit_post_link($post->ID);
                                $title = get_the_title($post->ID);
                                $title = esc_html($title);
                                $output .= '<div class="post_list_view_post';
                                if($current_post_ID == ($post->ID)) {
                                        $output .= ' post_current';
                                }
                                $output .= '">'
                                        . '<a href="'
                                        . $edit_link    . '">'
                                        . $title . '</a></div>';

                                /*** Search for children? ***/

                        }
                        $output .= '</div>';

                        $output .= '<a>';

                        if($post_type == 'post') {
                                add_posts_page( "Title", $output, "edit_posts", $custom_menu_slug, "custom_post_list_view_page");
                        } else {
                                 if ($post_type == 'page') {
                                        add_pages_page( "Title", $output, "edit_pages", $custom_menu_slug, "custom_post_list_view_page");
                                } else {
                                        if($post_type == 'attachment') {
                                                 add_media_page("Title", $output, "edit_posts", $custom_menu_slug, "custom_post_list_view_page");
                                        } else {
                                                add_submenu_page(('edit.php?post_type=" . $post_type), "Title", $output, "edit_posts", ("edit.php?post_type=" . $post_type), "custom_post_list_view_page");
                                        }
                                }
                        }
                }
        } // End foreach post type
}

function custom_post_list_view_page() { /* Empty */ }

Now it displays the submenu, and the current class doesn”t affect it. Where I output the submenu, I changed the <ul> and <li> to <div>. I added a check to see if the menu item equals the current post being edited, and a little CSS in the admin_head to highlight the item. Please refer to the code paste above.

Next, I’ll be looking into displaying child pages.