I have used a native html5 input date-picker in my code, It's working fine for me so far(i am only concerned about chrome and edge). But I am facing one issue: I want a uniform way to access the date picker but I notice that in my date picker there is a date picker button(pseudo-element) which is not accessible via keyboard, I tried to remove the pseudo-element by making its display none but then I lose the functionality to open the pop-up calendar via mouse.
- we have to press space to open via the keyboard as the icon is not accessible via the keyboard.
- we have to click on the icon to open the calendar popup via mouse.
As per accessibility standards if an element is accessible via mouse it should be accessible by keyboard too. so I need a work-around that.
I am looking for one of the following solutions - (any one of them will work)
Making the date icon accessible by keyboard.
Removing the date icon and making the calendar popup via mouse click instead of clicking on the icon.
Does anyone know the solution to this issue?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DatePicker</title>
<style>
</style>
</head>
<body>
<label for="mydate">DOB:</label>
<input type="date" id="mydate">
</body>
</html>