Skip to content

Conversation

@Kieran-Dolan
Copy link

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

@skyscanner-backpack-bot
Copy link

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

@skyscanner-backpack-bot
Copy link

skyscanner-backpack-bot bot commented Oct 22, 2025

Browser support

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

Generated by 🚫 dangerJS against ee723ed

@skyscanner-backpack-bot
Copy link

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

);

// Demonstrates opt-in wrapping via wrap={true}. Long text will wrap onto multiple lines.
const WrapExample = () => (

Choose a reason for hiding this comment

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

You should add another test with an extremely long, unbroken word like Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch as that is going to be an issue in German, Finnish and Hungarian (plus Welsh if we ever support it).

}

// Wrapping is opt-in; default is single-line via inherited nowrap styling.
&--wrap {

Choose a reason for hiding this comment

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

Nitpick but I'd be more specific about which type of wrap this enforces - word break and break all aren't the same.

const BpkTableCell = ({children, className = null, wrap = false, ...rest}) => {
const classNames = getClassName(
'bpk-table__cell',
wrap && 'bpk-table__cell--wrap',

Choose a reason for hiding this comment

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

Sorry for the vague comment but this doesn't feel like the right place to be doing this check.I'd personally write something that builds a array of classnames up and spread that into this.


`wrap` (boolean, default `false`)

Opt-in multi-line wrapping for cell content. By default (prop omitted or `false`) table cells render on a single line (nowrap). Set `wrap={true}` to apply the `bpk-table__cell--wrap` modifier class which sets `white-space: normal;` and allows long text to wrap onto multiple lines. Available on both `BpkTableCell` and `BpkTableHeadCell`.

Choose a reason for hiding this comment

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

As with above-

"Wrap" can mean a lot more than just word-wrap: break-word; and so this property name should be far more explicit in what it's doing.

@skyscanner-backpack-bot
Copy link

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

<BpkTable>
<BpkTableHead>
<BpkTableRow>
<BpkTableHeadCell wrap>Extremely Long Header Title That Will Wrap When Space Is Constrained</BpkTableHeadCell>
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for adding another example for the new feature. 👍
Could you add a URL content to one of these table cells to check if this satisfies the edge case you mentioned in our Slack conversation? THX.

BpkTableHeadCell.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
wrap: PropTypes.bool,
Copy link
Contributor

@Faye-Xiao Faye-Xiao Oct 28, 2025

Choose a reason for hiding this comment

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

It may be a little confusing for other consumers. Can we rename it to a more readable name like allowWrap or wrapText, for clarity?

</thead>
</table>,
);
expect(asFragment()).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently, we do not encourage contributors to use toMatchSnapshot. Could you use the jest expect DOM element instead?

expect(asFragment()).toMatchSnapshot();
});

it('should render correctly with wrap enabled', () => {
Copy link
Contributor

@Faye-Xiao Faye-Xiao Oct 28, 2025

Choose a reason for hiding this comment

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

I'm glad to see you added a new unit test for this prop, as mentioned in the comment r2467784300. I was considering the test coverage and was wondering if it would be possible to add a unit test for an edge case, such as a long text or link.

</tbody>
</table>,
);
expect(asFragment()).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

We currently do not encourage contributors to use toMatchSnapshot. Could you use the Jest expect function for DOM elements and help modify other use cases in this file to duplicate snapshot files? 🙇

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.

4 participants