I am trying to mimic a click interaction using CSS pseudo class selectors on responsive sidebar but somehow the focus event is not recognizing.
HTML
<html>
<body>
<nav class="sidebar">
<div class="smart"></div>
</nav>
</body>
</html>
CSS
*{
margin: 0;
padding: 0;
}
.sidebar{
width: 30vw;
height: 100vh;
background-color: grey;
}
@media (max-width:425px){
.sidebar{
width: 30vw;
transform: translate3d(-30vw, 0, 0);
transition: all 0.3s ease-in-out;
}
.smart{
position: absolute;
width: 40px;
height: 40px;
left: 100%;
background: black;
}
.sidebar:focus {
transform: translate3d(0, 0, 0);
}
.sidebar:focus .smart{
pointer-events: none;
}
}
https://jsfiddle.net/5Lt0mgyk/
Any help would be appreciated. TIA