Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add css_id parameter to Viewable components #7617

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add css_id parameter to Viewable components #7617

wants to merge 4 commits into from

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Jan 15, 2025

While we probably want to eventually expose this at the Bokeh level, adding an ID on the DOM nodes that correspond to Panel components is a useful way of referencing individual components for testing and when trying to look up a component. This PR implements this via tags, i.e. when an css_id is set this is added as an item in the tags property of the Model. On Document initialization on the frontend the css_id is then applied.

  • Add tests ensuring the id is added to all component types
  • Add tests ensuring the id is set on components added after initialization
  • Add documentation

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.75%. Comparing base (43761b8) to head (1e84dd5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7617      +/-   ##
==========================================
+ Coverage   81.83%   86.75%   +4.92%     
==========================================
  Files         341      341              
  Lines       51661    51688      +27     
==========================================
+ Hits        42275    44843    +2568     
+ Misses       9386     6845    -2541     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maximlt
Copy link
Member

maximlt commented Jan 15, 2025

How about html_id?

@MarcSkovMadsen
Copy link
Collaborator

Or element_id?

@Coderambling
Copy link
Contributor

Is it the case that CSS framework refer to this as "id"? In that case css_element_id might be the most appropriate.

I wonder if element_id might be confusing, or if, in future, some_other_thing_element_id might be a useful name, in which case element_id could become confusing.

Am I correcting in assuming the css element (with a unique id) would be available to all components (but not necessarily applied to all components)?

Would it be useful if the documentation contained code that shows how to list what components are using the CSS element? And what CSS elements a particular component uses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants