Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BlockStack] Add id prop to the returned component #11592

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

SMAKSS
Copy link
Contributor

@SMAKSS SMAKSS commented Feb 12, 2024

WHY are these changes introduced?

Fixes #11196

WHAT is this pull request doing?

It seems we missed returning the id prop when we created the final element with the React createElement API.

export const BlockStack = ({
  as = 'div',
  children,
  align,
  inlineAlign,
  gap,
  id,
  reverseOrder = false,
  ...restProps
}: BlockStackProps) => {
  ...

  return React.createElement(
    as,
    {
      className,
      // Missed the id prop in the final return component
      style: sanitizeCustomProperties(style),
      ...restProps,
    },
    children,
  );
};

🎩 checklist

@SMAKSS SMAKSS changed the title [BlockStack] Add id prop [BlockStack] Add id prop to the returned component Feb 12, 2024
@SMAKSS

This comment was marked as resolved.

Copy link
Contributor

Only users with write permission to the repository can run /snapit

@SMAKSS
Copy link
Contributor Author

SMAKSS commented Feb 22, 2024

Hello @alex-page and @sam-b-rose,

I'm reaching out as I'm uncertain about the ownership of this specific code segment. I encountered an issue about a week ago, which I found rather troublesome. According to the documentation, it suggests that <BlockStack /> should accept an id attribute, but it appears not to. This discrepancy led to some confusion and inefficiency on my end.

Thank you for taking the time to look into this. Your guidance would be invaluable.

Copy link
Member

@sam-b-rose sam-b-rose left a comment

Choose a reason for hiding this comment

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

Great catch—thank you for the fix! 🔧 💯

.changeset/wild-planets-confess.md Outdated Show resolved Hide resolved
@SMAKSS
Copy link
Contributor Author

SMAKSS commented Mar 12, 2024

Hi @sam-b-rose,

I wanted to just drop you a quick note to merge this PR if possible because the issue still persists.

Thank you so much.

@sam-b-rose sam-b-rose merged commit ad63158 into Shopify:main Mar 12, 2024
7 of 10 checks passed
@SMAKSS SMAKSS deleted the fix/block-stack-id branch March 12, 2024 20:12
kyledurand pushed a commit that referenced this pull request Mar 21, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @shopify/[email protected]

### Minor Changes

- [#11677](#11677)
[`f6ba2b2a8`](f6ba2b2)
Thanks [@jesstelford](https://github.com/jesstelford)! - Migrated
@shopify/polaris from SASS to CSS using postcss plugins


- [#11723](#11723)
[`4699bb229`](4699bb2)
Thanks [@mrcthms](https://github.com/mrcthms)! - Updated `BulkActions`
to only show actions when selectMode is `true`


- [#11727](#11727)
[`c3ba6ae1b`](c3ba6ae)
Thanks [@sam-b-rose](https://github.com/sam-b-rose)! - Removed the
responsive logic that disabled the Card bevel on mobile. Removing this
until we are ready to rollout bevel changes across all components.

### Patch Changes

- [#11757](#11757)
[`e0ae9565c`](e0ae956)
Thanks [@sophschneider](https://github.com/sophschneider)! - Added
dynamicTopBarAndReframe feature flag type


- [#11733](#11733)
[`9c24a465c`](9c24a46)
Thanks [@jesstelford](https://github.com/jesstelford)! - Convert
SASS-style inline comments to CSS-style multiline comments.


- [#11724](#11724)
[`1543246b7`](1543246)
Thanks [@sam-b-rose](https://github.com/sam-b-rose)! - Updated
responsive styles for `Text` component


- [#11765](#11765)
[`42c298ea7`](42c298e)
Thanks [@jesstelford](https://github.com/jesstelford)! - Fix build
performance regression from using postcss-mixins.


- [#11725](#11725)
[`3e011e3b6`](3e011e3)
Thanks [@kyledurand](https://github.com/kyledurand)! - Fixed a bug where
iOS 16 font patch wasn't added for mobile app web views


- [#11763](#11763)
[`e7ab4a8f5`](e7ab4a8)
Thanks [@sydturn](https://github.com/sydturn)! - Fixed `IndexTable.Row`
`onClick` not being called when `selectable` is `false`


- [#11745](#11745)
[`831a683a2`](831a683)
Thanks [@kyledurand](https://github.com/kyledurand)! - Fixed bug in
math.ts for popover with position cover


- [#11735](#11735)
[`6d8ef8c99`](6d8ef8c)
Thanks [@sam-b-rose](https://github.com/sam-b-rose)! - Used `Text`
component to apply text styles for `Button`


- [#11592](#11592)
[`ad6315845`](ad63158)
Thanks [@SMAKSS](https://github.com/SMAKSS)! - Passed missing `id` prop
to the root element of `BlockStack`

## @shopify/[email protected]

### Minor Changes

- [#11677](#11677)
[`f6ba2b2a8`](f6ba2b2)
Thanks [@jesstelford](https://github.com/jesstelford)! - Add `--pg-` as
a disallowed CSS Custom Property prefix (these are "global" Custom
Properties used within @shopify/polaris-react).

## @shopify/[email protected]

### Patch Changes

- [#11754](#11754)
[`f57db81df`](f57db81)
Thanks [@jesstelford](https://github.com/jesstelford)! - Move migrations
to v14 since the node v20 requirement will be the only change in v13

- Updated dependencies
\[[`f6ba2b2a8`](f6ba2b2)]:
    -   @shopify/[email protected]

## [email protected]

### Minor Changes

- [#11720](#11720)
[`97184dc80`](97184dc)
Thanks [@sarahill](https://github.com/sarahill)! - Added common action
guidance.


- [#11690](#11690)
[`c78f125c7`](c78f125)
Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Updates
images for icon design guidance

### Patch Changes

- [#11747](#11747)
[`5cff96245`](5cff962)
Thanks [@sarahill](https://github.com/sarahill)! - Updated card layout
patterns to match common action patterns.

- Updated dependencies
\[[`e0ae9565c`](e0ae956),
[`9c24a465c`](9c24a46),
[`f6ba2b2a8`](f6ba2b2),
[`4699bb229`](4699bb2),
[`c3ba6ae1b`](c3ba6ae),
[`1543246b7`](1543246),
[`42c298ea7`](42c298e),
[`3e011e3b6`](3e011e3),
[`e7ab4a8f5`](e7ab4a8),
[`831a683a2`](831a683),
[`6d8ef8c99`](6d8ef8c),
[`ad6315845`](ad63158)]:
    -   @shopify/[email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AnnaCheba pushed a commit to AnnaCheba/polaris that referenced this pull request Apr 22, 2024
<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Open it as a draft if it’s a work in progress
-->

### WHY are these changes introduced?

Fixes Shopify#11196 <!-- link to issue if one exists -->

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?
It seems we missed returning the `id` prop when we created the final
element with the React `createElement` API.

```js
export const BlockStack = ({
  as = 'div',
  children,
  align,
  inlineAlign,
  gap,
  id,
  reverseOrder = false,
  ...restProps
}: BlockStackProps) => {
  ...

  return React.createElement(
    as,
    {
      className,
      // Missed the id prop in the final return component
      style: sanitizeCustomProperties(style),
      ...restProps,
    },
    children,
  );
};
```

### 🎩 checklist

- [x] Tested a
[snapshot](https://github.com/Shopify/polaris/blob/main/documentation/Releasing.md#-snapshot-releases)
- [x] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [x] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [x] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [x] Updated the component's `README.md` with documentation changes
- [x] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
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.

BlockStack: ID not work
2 participants