feat(pds-box): add tag prop for semantic HTML elements#767
feat(pds-box): add tag prop for semantic HTML elements#767QuintonJason wants to merge 9 commits into
Conversation
✅ Deploy Preview for pine-design-system ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
474256e to
99efa12
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 90912b1. Configure here.
|
@QuintonJason, taking a look at this and want to make sure I'm not missing context before I land on a verdict. My gut says authors could just wrap The only case where tag wins over wrapping is if you specifically need the box styles (padding, gap, direction, etc.) on the semantic element itself and not a child of it. I feel like I may be missing something here, so just let me know. |
|
@QuintonJason, I looked closer, and |
|
Closing this. After review, feedback and thinking through maintenance cost, the tag prop adds too much ongoing complexity (display:contents, ARIA forwarding, dual render paths) for the use case. Wrapping pds-box in semantic HTML covers our needs without that debt. Happy to add a short docs note on when to wrap instead if that would help. |

Summary
tagprop topds-boxso it can render as semantic HTML elements (main,section,article,header,footer,nav,aside)divbehavior is unchanged — styles and classes stay on the host for backward compatibilitydivtags render an inner semantic element withdisplay: contentson the host so grid/row layout continues to workTest plan
pds-box.spec.tsx— tag prop coverage for all semantic variants)Test Configuration:
npx nx run @pine-ds/core:test --testPathPattern=pds-box.specpassesType of change
Checklist
Note
Medium Risk
Render tree and ARIA handling change for non-div tags and row layout selectors were extended; default div usage is unchanged but semantic/landmark usage needs correct labeling and regression checks in real pages.
Overview
Adds a
tagprop topds-boxso consumers can rendermain,section,nav, and other allowed semantic elements instead of always using the host as the flex/grid box.tag="div"(default) keeps the prior DOM: layout classes and inline styles stay on theHost.For non-
divtags, the component renders an inner semantic wrapper with the existingpds-boxclasses and styles, sets the host todisplay: contentsviapds-host--contents, and movesrole/aria-*from the host onto that inner element (with aMutationObserverso runtime ARIA updates still apply). Invalid tag values warn and fall back todiv.pds-box.scssrow/column rules now target.pds-row > pds-box > [class*='pds-box-']so grid sizing still works when the styled node is inside the custom element. Shared utils gainBoxTagType,isBoxTag, andreadAriaAttributes; Storybook, MDX, and unit specs cover semantic rendering and ARIA behavior.Reviewed by Cursor Bugbot for commit 41fc91d. Bugbot is set up for automated code reviews on this repo. Configure here.