Why are panel widget obfuscating bokeh model parameters?

I wanted to make a TextInput that I could give some properties to be able to select it from javascript using document.getElementbyId or document.getElementsbyName. However the name property of a Panel widget gets turned into a title property, and the name bokeh widget model property stays empty, although it is reflected on the HTML document.

I had to create the following subclass to achieve what I wanted:

class TextInput_with_name(pn.widgets.TextInput):
    _name = param.String(default='')
    
    _rename = pn.widgets.TextInput._rename.copy()
    _rename.update({'_name': 'name'})

To be noted that I tried to pass my TextInput object to a jscallback, then used document.getElementbyId(mytextinput.id) within my JS callback. It didn’t work.

I believe the name and tags properties should be reflected on both panel objects and their bokeh model.
Perhaps it’s the case and I didn’t find how to do that.
If it’s missing I can add an issue and work on a PR.

2 Likes