Skip to content

Add tool to highlight ignored elements#411

Merged
ghengeveld merged 9 commits intonextfrom
highlight-ignored-elements
Mar 25, 2026
Merged

Add tool to highlight ignored elements#411
ghengeveld merged 9 commits intonextfrom
highlight-ignored-elements

Conversation

@ghengeveld
Copy link
Copy Markdown
Member

@ghengeveld ghengeveld commented Mar 18, 2026

This adds a toolbar button to toggle element highlighting for Chromatic ignored elements.

Notable features:

  • Both explicit ignoreSelectors defined for the story, and Chromatic's default ignore selectors .chromatic-ignore and data-chromatic="ignore" are supported
  • Toggle button shows matched element count, even when disabled
  • Toggle button hides on stories with no matching elements
  • Highlights have a menu with details and link to the docs
Screen.Recording.2026-03-18.at.09.07.19.mov

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 29.56522% with 162 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.54%. Comparing base (01b63e6) to head (c5df0fb).
⚠️ Report is 12 commits behind head on next.

Files with missing lines Patch % Lines
src/components/GlobalIgnoreToggle.stories.tsx 2.08% 47 Missing ⚠️
src/components/GlobalIgnoreToggle.tsx 0.00% 41 Missing and 1 partial ⚠️
src/preview.ts 0.00% 36 Missing and 1 partial ⚠️
src/manager.tsx 0.00% 17 Missing ⚠️
.../screens/Authentication/Authentication.stories.tsx 0.00% 12 Missing ⚠️
src/preset.ts 0.00% 4 Missing ⚠️
src/index.ts 0.00% 2 Missing ⚠️
src/dev.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            next    #411      +/-   ##
========================================
+ Coverage   6.16%   6.54%   +0.38%     
========================================
  Files        161     165       +4     
  Lines      13936   14161     +225     
  Branches     293     305      +12     
========================================
+ Hits         859     927      +68     
- Misses     13000   13155     +155     
- Partials      77      79       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “ignored regions” highlighting support to the addon by introducing preview-side annotations/decorators, a manager toolbar toggle, and packaging/build updates to ship the new preview entrypoint.

Changes:

  • Add preview annotations (src/preview.ts) that can highlight elements matching Chromatic ignoreSelectors and emit a count to the manager.
  • Add a manager toolbar control (GlobalIgnoreToggle) and manager-side click handler to open docs for ignore configuration.
  • Extend build/package configuration to compile and export the preview entrypoint.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tsup.config.ts Adds previewEntries build target for browser ESM + DTS.
src/utils/ignoreHighlight.ts Builds highlight options/menu from Chromatic ignore selectors and defaults.
src/types.ts Adds typed globals (ignoredRegions) to addon types.
src/screens/Authentication/Authentication.stories.tsx Demonstrates ignoredRegions global usage and story-level ignoreSelectors.
src/preview.ts New preview decorator: applies highlight + counts matches and communicates to manager.
src/preset.ts Registers previewAnnotations so Storybook loads preview annotations.
src/manager.tsx Adds toolbar tool and handles “learn more” link clicks from highlight menu.
src/index.ts Wires preview annotations into definePreviewAddon.
src/dev.ts Ensures local dev Storybook loads preview annotations.
src/constants.ts Adds event keys, ids, and default ignore selectors.
src/components/GlobalIgnoreToggle.tsx New toolbar toggle showing ignored-element count and enabling highlight.
package.json Adds ./preview export and bundler previewEntries.
.storybook/preview.tsx Adds a default ignore selector (video) for local Storybook config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@ghengeveld ghengeveld added release Auto: Create a `latest` release when merged minor Auto: Increment the minor version when merged labels Mar 18, 2026
@ghengeveld ghengeveld self-assigned this Mar 18, 2026
@ghengeveld ghengeveld requested a review from JReinhold March 18, 2026 08:31
@ghengeveld ghengeveld merged commit dd30efd into next Mar 25, 2026
9 checks passed
@ghengeveld ghengeveld deleted the highlight-ignored-elements branch March 25, 2026 15:22
@ghengeveld ghengeveld mentioned this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Auto: Increment the minor version when merged release Auto: Create a `latest` release when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants