Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

[HER-1012] Add secondary panel to BpkDrawer - #4848

Merged
Faye (Faye-Xiao) merged 9 commits into
mainfrom
HER-1012/Add_secondary_column_to_BpkDrawer
Jul 8, 2026
Merged

Faye (Faye-Xiao) merged 9 commits into
mainfrom
HER-1012/Add_secondary_column_to_BpkDrawer

Conversation

@lucia-jiang

@lucia-jiang Lucia Jiang (lucia-jiang) commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds a secondaryPanel prop that renders a second column inside the drawer. The drawer expands to calc(var(--dynamic-width) * 2) via CSS transition to reveal the secondary content alongside the primary panel. No breaking changes to existing API.

Video:

trimed.mov

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 July 3, 2026 07:58
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

skyscanner-backpack-bot Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against f5ccccc

@lucia-jiang Lucia Jiang (lucia-jiang) added the minor Non breaking change label Jul 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds optional dual-panel support to BpkDrawer by introducing a secondaryPanel prop and updating layout/styling so a second column can slide in alongside the primary drawer content.

Changes:

  • Add secondaryPanel API to BpkDrawer/BpkDrawerContent and render a secondary column when open.
  • Update drawer SCSS to support width transitions and dual-panel layout.
  • Add Storybook example and tests covering secondary panel rendering and close interaction.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawerContent.tsx Renders primary/secondary panel layout and adds dual-panel class toggling.
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawerContent.module.scss Adds width transition and flex-based two-column panel styles.
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer.tsx Introduces exported SecondaryPanelProps and forwards secondaryPanel through.
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer.stories.js Adds Storybook example demonstrating secondary panel usage.
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer-test.tsx Adds tests for secondary panel render conditions and close callback.

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

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

1 similar comment
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Adds a `secondaryPanel` prop that renders a second column inside the
drawer. The drawer expands to calc(var(--dynamic-width) * 2) via CSS
transition to reveal the secondary content alongside the primary panel.
No breaking changes to existing API.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor


import type { ReactNode } from 'react';

export type SecondaryPanelProps = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a way to keep the primary & secondary panel props in sync? Ideally we could have 'an array of drawers' that all render as 1 drawer one after the other :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi Gert! Thanks for your comment. It is a good idea to sync them, but!

The primary panel is structurally different from the secondary panel, a unified array shape would either force dialog-level props (dialogRef, closeOnScrimClick, mobileModalDisplay, isIpad, isIphone) onto every panel object where they'd never be used, or require a significant refactor of how BpkDrawer owns the dialog vs the panel content.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is how the first and second pannel would look like
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For visibility: agreed to keep a single sub-panel. Thanks!

</DrawerContainer>
);

class DrawerWithSecondaryPanelContainer extends Component {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: just curious if there’s a particular reason you're leaning towards class components? I noticed that most of the recent stories in this file are using functional components and hooks. It might be worth considering a switch for the sake of consistency. What do you think? 😊

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks Faye, good point! I modified it now ☺️

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

</div>
<div
role="complementary"
aria-label={secondaryPanel.ariaLabel ?? 'Secondary panel'}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: the fallback Secondary panel is hardcoded English, which means consumers who don't pass ariaLabel silently get incorrect screen reader text in non-English contexts. Since a single complementary landmark doesn't require an accessible name, you can just drop the fallback:

- aria-label={secondaryPanel.ariaLabel ?? 'Secondary panel'}
+ aria-label={secondaryPanel.ariaLabel}

@Faye-Xiao Faye (Faye-Xiao) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@Faye-Xiao
Faye (Faye-Xiao) merged commit f26a284 into main Jul 8, 2026
15 checks passed
@Faye-Xiao
Faye (Faye-Xiao) deleted the HER-1012/Add_secondary_column_to_BpkDrawer branch July 8, 2026 08:11
Stephen Hailey (steviehailey-skyscanner) added a commit that referenced this pull request Jul 23, 2026
…eTitle is set

PR #4848 removed the `&nbsp;` spacer that was keeping the close button
at the trailing end of the flex header when the title is visually hidden
(position: absolute, so out of flex flow). With only one flex item and
justify-content: space-between, the button fell back to flex-start (left).

Fix: add margin-inline-start: auto to __close-button so it always pushes
to the trailing edge — works for both the visible-title and hidden-title
cases, and is RTL-safe via logical properties.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Iris Li (wpe1arhy) pushed a commit that referenced this pull request Jul 24, 2026
…itle is set (#4962)

* [IRN-6874][BpkDrawer] Export SecondaryPanelProps from public index

SecondaryPanelProps was added to Props in 43.7.0 but never re-exported
from index.ts, causing TS2742 in consumers whose declaration emit needs
a stable import path for the type.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>

* [IRN-6874][BpkDrawer] Fix close button reverting to top-left when hideTitle is set

PR #4848 removed the `&nbsp;` spacer that was keeping the close button
at the trailing end of the flex header when the title is visually hidden
(position: absolute, so out of flex flow). With only one flex item and
justify-content: space-between, the button fell back to flex-start (left).

Fix: add margin-inline-start: auto to __close-button so it always pushes
to the trailing edge — works for both the visible-title and hidden-title
cases, and is RTL-safe via logical properties.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>

* [IRN-6874][BpkDrawer] Pin close control to trailing edge via header last-child

Refine the earlier fix: instead of margin-inline-start on __close-button
only, apply it to the header's last child. This also covers the closeText
(BpkLink) variant, so hideTitle + closeText together no longer collapses
the control to the leading edge.

margin-inline-start: auto is RTL-safe — resolves to right in LTR and left
in RTL. Verified in Storybook across default, hideTitle, closeText, and RTL.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 (1M context) <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants