Consider the following HTML code snippet:
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="styles.css">
    </head>
    <body>
        <nav>
            <a href="" id="menu-icon"></a>
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Work</a></li>
                <li><a href="#">Blog</a></li>
                <li><a href="#">Contact</a></li>
            </ul>
        </nav>
    </body>
</html>
and the respective CSS code snippet (styles.css):
#menu-icon {
    width: 40px;
    height: 40px;
    background-color: blue;
}
a#menu-icon:hover {background-color: black;}
#menu-icon {display:inline-block;}
nav ul {
    display: none;
    position: absolute;
    padding: 20px;
    border: 1px solid black;
    right: 20px;
    top: 60px;
    width: 50%;
}
nav:hover ul {display: block;}
Basically, this is a simple navigation bar intended to work both for desktop and mobile. However, there is a problem when you use it in mobile: the menu disappear just after you touch the icon.
In order to solve this problem, it is necessary to change the line <a href="" id="menu-icon"></a> to <a href="#" id="menu-icon"></a>.
Issue
Is this behavior expected? Why? What is the reasoning for it?
 
     
    