Hi,
I would like to use TextAreaInput (editable=False) to display some text. This works ok but the text scrolls out of view and I want the most recently added text to be visible.
In order to do this I’m trying to call the scrollIntoView, javascript method as shown below
text_area = TextAreaInput(value="", disabled=True, rows=25)
# CustomJS callback to scroll the TextAreaInput into view
callback = CustomJS(args=dict(text_area=text_area), code="""
// Log the Bokeh model to understand its structure
console.log(text_area);
// Use the ID to select the element
const text_area_el = document.getElementById(text_area.id);
console.log("text_area_el="+text_area_el);
if (text_area_el) {
text_area_el.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
""")
text_area.js_on_change('value', callback)
subsequently the text is updated
text_area.value = text_area.value + "some text"
The javascript code is called but it does not work because text_area_el is always null.
Can anyone point out how I can get a reference to the element to call scrollIntoView() on ?
Paul