Can the Shadow Input DOMs be modified to show an ID?

Is there a way for the shadow dom input fields to be focusable?
A little backstory…I’m fixing the anki-editor-autocomplete (GitHub - src-r-r/anki-editor-autocomplete at 20201WW14_fix-for-anki-2.1.43 for reference).

Everything works beautifully up until I need to fill in the autocompleted value. There’s a problem. The input field is within the shadow dom, which means that I can’t select it as a value. Checking out the HTML source code I see there is nothing by which to identify the fields.

This can be seen here: anki-editor-autocomplete/autocompletion.js at 20201WW14_fix-for-anki-2.1.43 · src-r-r/anki-editor-autocomplete · GitHub

So this plugin is essentially broken since I can’t fetch the field. The code works beautifully in the console if I set field to the anki-editable that I copy to the console. I can focus the the field and set it to whatever I want.

Was there something changed in Anki 2 that I’m missing? Or is there a way to add an id field, or a function to the shadow dom to allow this functionality?



1 Like