Currently I am trying to set a function that will click on the little clock inside of <input type=time>
but am unable to find the innerHTML of the tag to find the clock.
This is what I want to do:
html
<input id='timeInput' type='time'/>
JS
document.getElementById("timeInput").children('clockIcon').click()
But when I run a document.getElementById('timeInput').innerHTML
I get null.
I believe that this has something to do with the Shadow DOM, but have been unable to find the information about the shadow DOM input.
I have previously been able to check the hidden browser HTML, but am unable to find that previous resource. Any ideas?
To specify, my app only shows on Chrome and Opera browsers since it is a Chrome extension.
There's no way to interact with the shadow DOM. The whole purpose of a shadow tree is to isolate functionality, behavior, and styles from the outside world - even if the mode is "open". If the author of a particular component wants you to be able to control the behavior or styles, they will provide an API for doing so. If the author does not provide an API for it, they don't want you mucking around with it.
When it comes to using form fields, my rule of thumb is to always follow one of these rules:
For example, automatically displaying a time picker would take focus away from what the user was doing. Maybe the screen reader was reading some text, or a power user was tabbing through the navigation using their keyboard, and then all the sudden they're on the time picker when they didn't want to be.
Whatever you do, don't try to roll your own fancy form controls. I guarantee you will piss off one of your users.