Skip to content

TabPanel.title="constructor" differs between initial render and DocumentReady update #15129

@ym-xie

Description

@ym-xie

Software versions

Python version : 3.12.13 (main, May 10 2026, 19:30:01) [Clang 22.1.3 ]
IPython version : 9.13.0
Tornado version : 6.5.5
NumPy version : 2.4.6
Bokeh version : 3.10.0.dev5+2.g5ce73b2d
BokehJS static path : /data/gap/a5d4/bokeh/src/bokeh/server/static
node.js version : v20.19.2
npm version : 11.12.1
jupyter_bokeh version : (not installed)
Operating system : Linux-6.12.88+deb13-amd64-x86_64-with-glibc2.41

Browser name and version

Chromium 148.0.7778.215 built on Debian GNU/Linux 13 (trixie)

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

Changing TabPanel.title should update the visible tab title consistently whether the value is configured before initial render or assigned from JavaScript at document ready.

Observed behavior

When a TabPanel.title is set to "constructor" before initial render, the visible tab title differs from the same assignment made in a DocumentReady callback.

Example code

from __future__ import annotations

from pathlib import Path

from bokeh.document import Document
from bokeh.events import DocumentReady
from bokeh.io.export import get_screenshot_as_png
from bokeh.models import CustomJS, Div, TabPanel, Tabs


OUT_DIR = Path(__file__).resolve().parent
TITLE = "constructor"


def build_doc() -> tuple[Document, TabPanel]:
    doc = Document()
    tab0 = TabPanel(child=Div(text="first", width=220, height=120), title="circle")
    tab1 = TabPanel(child=Div(text="second", width=220, height=120), title="line")
    tabs = Tabs(tabs=[tab0, tab1], width=260, height=180)
    doc.add_root(tabs)
    return doc, tab1


def save_before_initial_render() -> None:
    doc, tab = build_doc()
    tab.title = TITLE
    img = get_screenshot_as_png(doc)
    img.save(OUT_DIR / "tabpanel_title_before_initial_render.png")


def save_after_document_ready() -> None:
    doc, tab = build_doc()
    doc.js_on_event(
        DocumentReady,
        CustomJS(args=dict(tab=tab), code=f'tab.title = "{TITLE}";'),
    )
    img = get_screenshot_as_png(doc)
    img.save(OUT_DIR / "tabpanel_title_after_document_ready.png")


if __name__ == "__main__":
    save_before_initial_render()
    save_after_document_ready()
    print("saved tabpanel_title_before_initial_render.png")
    print("saved tabpanel_title_after_document_ready.png")

Stack traceback or browser console output

No response

Screenshots

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions