Skip to content

Core: Fix testing widget focus outline#33172

Merged
ghengeveld merged 4 commits into
nextfrom
fix-testing-widget-focus-outline
Nov 25, 2025
Merged

Core: Fix testing widget focus outline#33172
ghengeveld merged 4 commits into
nextfrom
fix-testing-widget-focus-outline

Conversation

@ghengeveld
Copy link
Copy Markdown
Member

@ghengeveld ghengeveld commented Nov 25, 2025

What I did

Use ActionList components in TestingWidget for consistency with ChecklistWidget and to fix focus outline issues.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • New Features

    • Added a Toggle variant to ActionList for expanded control options and consistent focus/visual behavior.
  • Refactor

    • Internal UI controls switched to ActionList variants for unified styling and interactions.
    • Renamed an internal guide action component for naming consistency and replaced several button usages with ActionList equivalents.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 25, 2025

📝 Walkthrough

Walkthrough

Adds an ActionList Toggle variant and exposes it as ActionList.Toggle. Replaces several Button/ToggleButton usages inside sidebar widgets: renames OpenGuideActionOpenGuideButton, migrates widget controls to ActionList.Button/ActionList.Toggle, and introduces a RunButton using ActionList.Button.

Changes

Cohort / File(s) Summary
ActionList Toggle support
code/core/src/components/components/ActionList/ActionList.tsx
Adds StyledToggleButton and ActionListToggle wrapper that forwards padding, size, variant, and ref; exposes ActionList.Toggle. Adjusts prop spreading on existing Button path to forward variant, padding, size, and ref.
ChecklistWidget migration
code/core/src/manager/components/sidebar/ChecklistWidget.tsx
Renames internal OpenGuideActionOpenGuideButton and replaces ActionList.Action usages with ActionList.Button in content and fallback render paths; preserves afterClick behavior.
TestingWidget refactor
code/core/src/manager/components/sidebar/TestingWidget.tsx
Replaces direct Button/ToggleButton usage with ActionList.Button and ActionList.Toggle. Adds RunButton (uses ActionList.Button) with isRunning/onRunAll handling and stopPropagation on click; updates StatusButton to use ActionList.Toggle and other internal wiring.

Sequence Diagram(s)

sequenceDiagram
    participant Widget as Sidebar Widget UI
    participant AL as ActionList (Button / Toggle)
    participant Run as RunButton
    participant App as App logic

    Note right of AL: New public member: ActionList.Toggle
    Widget->>AL: render Button / Toggle (props: padding,size,variant,ref)
    AL-->>Widget: styled control (focus, padding, size, variant)
    Widget->>Run: click RunButton (event)
    Run->>Run: event.stopPropagation()
    Run->>App: onRunAll()
    App-->>Run: run state (isRunning)
    Run-->>Widget: update UI (disabled / icon / tooltip)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on:
    • code/core/src/components/components/ActionList/ActionList.tsx — correctness of prop forwarding, ref handling, and focus-visible styling for the new Toggle.
    • code/core/src/manager/components/sidebar/TestingWidget.tsx — RunButton event.stopPropagation, isRunning/onRunAll flow, and accessibility attributes.
    • code/core/src/manager/components/sidebar/ChecklistWidget.tsx — ensure rename preserves prior behavior and any analytics/afterClick hooks.

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53486ac and 5d35723.

📒 Files selected for processing (3)
  • code/core/src/components/components/ActionList/ActionList.tsx (3 hunks)
  • code/core/src/manager/components/sidebar/ChecklistWidget.tsx (5 hunks)
  • code/core/src/manager/components/sidebar/TestingWidget.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use camelCase for variable and function names

Files:

  • code/core/src/manager/components/sidebar/ChecklistWidget.tsx
  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Enable TypeScript strict mode
Export functions from modules for testing purposes

Files:

  • code/core/src/manager/components/sidebar/ChecklistWidget.tsx
  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
**/*.{ts,tsx,js,jsx,json,html,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,json,html,mjs}: Use ESLint and Prettier for code style enforcement
Run 'yarn prettier --write ' to format code after making changes
Run 'yarn lint:js:cmd ' to check for ESLint issues after making changes

Files:

  • code/core/src/manager/components/sidebar/ChecklistWidget.tsx
  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
code/**/!(*.test).{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

code/**/!(*.test).{ts,tsx,js,mjs}: Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size

Files:

  • code/core/src/manager/components/sidebar/ChecklistWidget.tsx
  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
🧠 Learnings (5)
📓 Common learnings
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Tabs/Tabs.stories.tsx:222-227
Timestamp: 2025-11-05T09:36:55.944Z
Learning: Repo: storybookjs/storybook PR: 32458 — In code/core/src/components/components/Button/Button.tsx (React/TypeScript), ButtonProps includes ariaLabel?: string | false and the component maps it to the DOM aria-label. Convention: ariaLabel is mandatory on all Button usages — provide a descriptive string for icon-only buttons; set ariaLabel=false when the button’s children already serve as the accessible name. Do not suggest using a raw aria-label prop on Button call sites.
📚 Learning: 2025-11-05T09:36:55.944Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Tabs/Tabs.stories.tsx:222-227
Timestamp: 2025-11-05T09:36:55.944Z
Learning: Repo: storybookjs/storybook PR: 32458 — In code/core/src/components/components/Button/Button.tsx (React/TypeScript), ButtonProps includes ariaLabel?: string | false and the component maps it to the DOM aria-label. Convention: ariaLabel is mandatory on all Button usages — provide a descriptive string for icon-only buttons; set ariaLabel=false when the button’s children already serve as the accessible name. Do not suggest using a raw aria-label prop on Button call sites.

Applied to files:

  • code/core/src/manager/components/sidebar/ChecklistWidget.tsx
  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
📚 Learning: 2025-11-25T11:09:33.788Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 33140
File: code/core/src/manager/components/sidebar/TagsFilter.tsx:247-259
Timestamp: 2025-11-25T11:09:33.788Z
Learning: In the storybookjs/storybook repository, PopoverProvider creates popovers with a dialog role, so using aria-haspopup="dialog" on buttons that trigger PopoverProvider is semantically correct.

Applied to files:

  • code/core/src/manager/components/sidebar/ChecklistWidget.tsx
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.

Applied to files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
📚 Learning: 2025-11-05T09:37:25.920Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/tooltip/WithTooltip.tsx:54-96
Timestamp: 2025-11-05T09:37:25.920Z
Learning: Repo: storybookjs/storybook — In code/core/src/components/components/tooltip/WithTooltip.tsx, the legacy WithTooltip implementation is intentionally reintroduced for backward compatibility and is deprecated; maintainers (per Sidnioulz) do not want maintenance or improvements on it. Prefer WithTooltipNew/Popover; avoid suggesting changes to WithTooltip.* going forward.

Applied to files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
🧬 Code graph analysis (3)
code/core/src/manager/components/sidebar/ChecklistWidget.tsx (1)
code/core/src/components/components/ActionList/ActionList.tsx (1)
  • ActionList (178-199)
code/core/src/manager/components/sidebar/TestingWidget.tsx (2)
code/core/src/components/components/ActionList/ActionList.tsx (1)
  • ActionList (178-199)
code/core/src/manager/components/sidebar/StatusButton.tsx (1)
  • StatusButton (87-89)
code/core/src/components/components/ActionList/ActionList.tsx (1)
code/core/src/components/index.ts (1)
  • ToggleButton (58-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: normal
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (14)
code/core/src/components/components/ActionList/ActionList.tsx (5)

7-7: LGTM!

The ToggleButton import follows the established pattern and is necessary for the new Toggle variant.


93-98: LGTM!

The focus outline fix mirrors the existing StyledButton pattern and correctly prevents the outline from being clipped by overflow: hidden in parent containers.


100-107: LGTM!

The prop spreading order correctly ensures that the destructured defaults for variant, padding, size, and ref take precedence after applying their default values.


109-116: LGTM!

ActionListToggle follows the same pattern as ActionListButton with consistent defaults and prop handling.


193-193: LGTM!

The Toggle export is correctly added to the ActionList API, making it available as ActionList.Toggle.

code/core/src/manager/components/sidebar/ChecklistWidget.tsx (3)

149-172: LGTM!

The rename from OpenGuideAction to OpenGuideButton and the migration to ActionList.Button aligns with the new ActionList primitives. The accessibility label is properly set per coding conventions.

Based on learnings, ariaLabel is correctly provided as a descriptive string for the button.


211-212: LGTM!

The OpenGuideButton usages are updated consistently, preserving the Optional pattern for responsive text display.


236-238: LGTM!

The OpenGuideButton usage within the popover is correctly updated with the afterClick callback.

code/core/src/manager/components/sidebar/TestingWidget.tsx (6)

1-9: LGTM!

The expanded React imports are necessary for the new RunButton component's type definitions.


12-12: LGTM!

The import changes correctly reflect the migration from standalone Button to ActionList-based primitives.


72-78: LGTM!

The CollapseToggle migration to ActionList.Button preserves the existing styling and behavior.


270-274: LGTM!

The RunButton usages correctly implement the Optional pattern for responsive text display, with proper prop passing.


339-351: LGTM!

The clear statuses button is correctly migrated to ActionList.Button with proper accessibility labels for the icon-only button.

Based on learnings, ariaLabel is correctly provided as a descriptive string for the icon-only button.


105-133: The original review comment is incorrect.

The StatusButton component correctly uses the pressed prop. The ToggleButtonProps interface explicitly defines pressed: boolean as the official prop name for controlling toggle state. The ToggleButton component implementation expects this prop, and ActionList.Toggle inherits this interface. The code is using the intended prop name.

Likely an incorrect or invalid review comment.

Comment thread code/core/src/manager/components/sidebar/TestingWidget.tsx
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Nov 25, 2025

View your CI Pipeline Execution ↗ for commit 9477e23

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 46s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-25 17:59:51 UTC

Comment thread code/core/src/components/components/ActionList/ActionList.tsx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
code/core/src/manager/components/sidebar/TestingWidget.tsx (1)

1-9: ActionList-based controls (collapse, run, status) are wired correctly

  • Imports (React types/hooks, ActionList, Card) match actual usage with no leakage.
  • CollapseToggle as ActionList.Button with opacity 0 plus hover/focus override keeps the “only show chevron on hover” behavior while remaining visible when focused, which is important for keyboard users.
  • RunButton cleanly wraps ActionList.Button: isRunning drives disabled, ariaLabel, and tooltip, and the onClick handler stops propagation before calling onRunAll, so it won’t accidentally toggle the panel.
  • StatusButton built on ActionList.Toggle with pressed and status-based styling, plus outlineOffset: -2, is consistent with the new ActionList focus treatment and avoids focus outlines being clipped inside the overflow-hidden bar.

I don’t see any functional or typing issues here; the changes align well with the stated focus-outline fix and a11y patterns.

Also applies to: 12-13, 72-79, 80-103, 105-133

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 123405f and 9477e23.

📒 Files selected for processing (2)
  • code/core/src/components/components/ActionList/ActionList.tsx (3 hunks)
  • code/core/src/manager/components/sidebar/TestingWidget.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use camelCase for variable and function names

Files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Enable TypeScript strict mode
Export functions from modules for testing purposes

Files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
**/*.{ts,tsx,js,jsx,json,html,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,json,html,mjs}: Use ESLint and Prettier for code style enforcement
Run 'yarn prettier --write ' to format code after making changes
Run 'yarn lint:js:cmd ' to check for ESLint issues after making changes

Files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
code/**/!(*.test).{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

code/**/!(*.test).{ts,tsx,js,mjs}: Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size

Files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Tabs/Tabs.stories.tsx:222-227
Timestamp: 2025-11-05T09:36:55.944Z
Learning: Repo: storybookjs/storybook PR: 32458 — In code/core/src/components/components/Button/Button.tsx (React/TypeScript), ButtonProps includes ariaLabel?: string | false and the component maps it to the DOM aria-label. Convention: ariaLabel is mandatory on all Button usages — provide a descriptive string for icon-only buttons; set ariaLabel=false when the button’s children already serve as the accessible name. Do not suggest using a raw aria-label prop on Button call sites.
📚 Learning: 2025-11-05T09:36:55.944Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Tabs/Tabs.stories.tsx:222-227
Timestamp: 2025-11-05T09:36:55.944Z
Learning: Repo: storybookjs/storybook PR: 32458 — In code/core/src/components/components/Button/Button.tsx (React/TypeScript), ButtonProps includes ariaLabel?: string | false and the component maps it to the DOM aria-label. Convention: ariaLabel is mandatory on all Button usages — provide a descriptive string for icon-only buttons; set ariaLabel=false when the button’s children already serve as the accessible name. Do not suggest using a raw aria-label prop on Button call sites.

Applied to files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
  • code/core/src/components/components/ActionList/ActionList.tsx
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.

Applied to files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
📚 Learning: 2025-11-05T09:37:25.920Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/tooltip/WithTooltip.tsx:54-96
Timestamp: 2025-11-05T09:37:25.920Z
Learning: Repo: storybookjs/storybook — In code/core/src/components/components/tooltip/WithTooltip.tsx, the legacy WithTooltip implementation is intentionally reintroduced for backward compatibility and is deprecated; maintainers (per Sidnioulz) do not want maintenance or improvements on it. Prefer WithTooltipNew/Popover; avoid suggesting changes to WithTooltip.* going forward.

Applied to files:

  • code/core/src/manager/components/sidebar/TestingWidget.tsx
🧬 Code graph analysis (2)
code/core/src/manager/components/sidebar/TestingWidget.tsx (2)
code/core/src/components/components/ActionList/ActionList.tsx (1)
  • ActionList (178-199)
code/core/src/manager/components/sidebar/StatusButton.tsx (1)
  • StatusButton (87-89)
code/core/src/components/components/ActionList/ActionList.tsx (1)
code/core/src/components/index.ts (1)
  • ToggleButton (58-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: normal
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (2)
code/core/src/components/components/ActionList/ActionList.tsx (1)

7-8: ActionList.Toggle + focus styling and prop forwarding look solid

The new StyledToggleButton mirrors the StyledButton focus-visible handling, and both ActionListButton and ActionListToggle correctly forward props while enforcing default variant, padding, and size. Exposing Toggle on ActionList keeps the API coherent with Button. No issues from my side here.

Also applies to: 93-99, 100-107, 109-116, 193-194

code/core/src/manager/components/sidebar/TestingWidget.tsx (1)

270-275: RunButton usages and “clear statuses” action look consistent; please sanity‑check keyboard focus

  • The Optional usage of RunButton (text + icon when there’s space, icon-only fallback) keeps a stable ariaLabel/tooltip and reuses the same behavior surface, which is good.
  • The clear-statuses control now using ActionList.Button with an icon child and explicit ariaLabel, plus disabled={isRunning} and stopPropagation() in onClick, matches the patterns used for the other actions and avoids accidental collapse toggling.

Given the PR’s goal, I’d recommend a quick manual pass with keyboard-only navigation (tabbing through Run, collapse, status filters, and clear-statuses in both collapsed/expanded states) to confirm all focus outlines are visible and not clipped.

Also applies to: 339-352

@ghengeveld ghengeveld merged commit 350cf07 into next Nov 25, 2025
66 of 67 checks passed
@ghengeveld ghengeveld deleted the fix-testing-widget-focus-outline branch November 25, 2025 18:31
@github-actions github-actions Bot mentioned this pull request Nov 25, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants