Skip to content

[NO-JIRA][BpkCloseButton&BpkSplitInput] Migrate entry point from js to ts#4316

Open
IrinaWei wants to merge 4 commits intomainfrom
fix-typecheck
Open

[NO-JIRA][BpkCloseButton&BpkSplitInput] Migrate entry point from js to ts#4316
IrinaWei wants to merge 4 commits intomainfrom
fix-typecheck

Conversation

@IrinaWei
Copy link
Contributor

Description

Migrate bpk-component-split-input and bpk-component-close-button entry points from Flow-typed JS to TypeScript.

Changes

  • bpk-component-split-input/index.jsindex.ts: removed stale /* @flow strict */ annotation
  • bpk-component-split-input/src/BpkSplitInput.tsx: added export to interface Props so it can be re-exported via index.ts
  • bpk-component-close-button/index.jsindex.ts: removed stale /* @flow strict */ annotation

Impact

No breaking changes. The public API surface (export default, export { INPUT_TYPES }, export type { BpkSplitInputProps }) is identical to before. Consumers import from the compiled dist/index.js which is unaffected by the source file rename.

Checklist

  • No breaking changes to exported API
  • Removed stale Flow annotations (codebase uses TypeScript)
  • Tests pass

Remember to include the following changes:

  • Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [Clover-123][BpkButton] Updating the colour
  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Accessibility tests
    • The following checks were performed:
      • Ability to navigate using a keyboard only
      • Zoom functionality (Deque University explanation):
        • The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
        • Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
      • Ability to navigate using a screen reader only
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

Copilot AI review requested due to automatic review settings March 24, 2026 09:08
@IrinaWei IrinaWei added the patch Patch production bug label Mar 24, 2026
Copy link
Contributor

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

Migrates the public entry points for bpk-component-split-input and bpk-component-close-button from Flow-annotated JS to TypeScript, aligning with the repo’s TypeScript usage while preserving the existing public API exports.

Changes:

  • Replaced index.js entry points with index.ts and removed stale /* @flow strict */ annotations.
  • Exported Props from BpkSplitInput.tsx so it can be re-exported as BpkSplitInputProps via the package entry point.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/bpk-component-split-input/src/BpkSplitInput.tsx Exports Props interface to enable type re-export from the entry point.
packages/bpk-component-split-input/index.ts TypeScript entry point; removes Flow annotation while keeping the same exports (default, INPUT_TYPES, BpkSplitInputProps).
packages/bpk-component-close-button/index.ts TypeScript entry point; removes Flow annotation while preserving default export.

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

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4316 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4316 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4316 to see this build running in a browser.

Copy link
Contributor Author

@IrinaWei IrinaWei left a comment

Choose a reason for hiding this comment

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

Code review

Found 2 issues (reviewed by 4/6 agents — Agent 2 skipped: no .scss files; Agent 6 skipped: no relevant historical comments):

🤖 Generated with Claude Code

<div className={getClassName('bpk-drawer__close-button')}>
<BpkCloseButton label={closeLabel} onClick={onClose} />
<BpkCloseButton label={closeLabel ?? ''} onClick={onClose} />
</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Empty aria-label on close button when closeLabel is omitted

BpkCloseButton uses label directly as both aria-label and title on the <button>. With closeLabel ?? '', when closeLabel is undefined the button renders aria-label="" — an explicit empty accessible name. This is a WCAG 2.2 SC 4.1.2 violation: screen readers will announce the button as unlabelled.

Fix: Make closeLabel required in BpkDrawerContent props when the close button is rendered, or guard against rendering the close button when the label is absent — do not fall back to "".

<div className={getClassName('bpk-drawer__close-button')}>
<BpkCloseButton label={closeLabel} onClick={onClose} />
<BpkCloseButton label={closeLabel ?? ''} onClick={onClose} />
</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Snapshot will fail — needs regeneration

The closeLabel ?? '' change is a rendered-output change: when closeLabel is undefined, the button previously had no aria-label/title attributes; after this PR it renders aria-label="" title="". Tests that render without passing closeLabel (e.g. the padded=true test) will produce a different DOM and the existing .snap will not match.

Fix: After resolving the empty-string issue above, run npm test -- --updateSnapshot for bpk-component-drawer and commit the regenerated snapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Patch production bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants