Skip to content

Fix BarWidget CSS leakage by scoping selectors#35

Open
RedZapdos123 wants to merge 1 commit intokoaning:mainfrom
RedZapdos123:fix/barwidget-css-scope-26
Open

Fix BarWidget CSS leakage by scoping selectors#35
RedZapdos123 wants to merge 1 commit intokoaning:mainfrom
RedZapdos123:fix/barwidget-css-scope-26

Conversation

@RedZapdos123
Copy link
Copy Markdown
Contributor

@RedZapdos123 RedZapdos123 commented Apr 22, 2026

Description:

Issue #26 reported that BarWidget CSS leaked into other notebook outputs because generic selectors such as .container and label were globally applied.

This PR updates BarWidget styling, and control selection to use widget scoped classes in both source, and bundled JS paths, preserving styling isolation across notebook outputs.

It also adds regression tests that cover selector scoping and container scoped control selection.

Closes #26.

Checklist:

  • I have reviewed all changes in this PR myself.
  • I have added relevant regression test cases for this fix.
  • I have run linting and formatting checks in WSL using ruff check tests/test_bar_widget_scoping.py.
  • I have run focused tests in WSL using pytest -q tests/test_bar_widget_scoping.py.
  • I have run full tests in WSL using pytest -q.
  • I manually validated the visual behavior, and confirmed no CSS leakage to external .container elements.

The validation screenshots of the tests run (include visual test), locally on WSL:

Screenshot 2026-04-22 200857 Screenshot 2026-04-22 200846

Scope BarWidget CSS classes under a widget-specific container and localize control button queries to the widget container.

Add regression tests to prevent global selector and document-level query regressions.

Closes koaning#26.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
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.

BarWidget CSS leaks out to other elements

2 participants