-
Notifications
You must be signed in to change notification settings - Fork 418
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
feat(pte): expose data-attributes on PTE Text + Object blocks #6641
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated May 14, 2024 8:35 AM (UTC)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi 👋
Thanks for doing this! ✨
Questions
.. but does lead to some interesting questions!
When it comes to exposing arbitrary (non-test) data-attributes, is there a convention we should use to denote certain attributes as protected and in use externally?
- E.g. I could easily see a future where someone searches for instances of these data attrs, finds none within the studio and then marks them for deletion.
- If there isn't an existing convention, is it worth just attaching inline comments to these?
As above, how customisable should PTE and all rendered output be? Perhaps a convention could be made where if we are applying styles-in-js, that we provide a data-attr / escape hatch for users to override these externally.
Nothing that needs to be actioned any time soon, but perhaps worth formalising eventually (especially as we start to see more PTE usage within the studio outside of document forms)
I am ok with approving this though your questions are valid. I am not sure what is the best forum for this 🤔 maybe this is something that should be brought up with you joining the weekly sync or maybe I can bring it up? I'm not sure! @jtpetty would that be the right course of action?
Thanks @RitaDias – just added inline comments until we have more guidance here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* feat: expose data attributes on PTE text block components * feat: expose data attributes on PTE default block object component
Description
This tiny PR adds data attributes to PTE text + object blocks, as well as their children which have styles applied in JS (via
innerPaddingProps
)These have been added in order for Create to be able to safely target and override styles applied on these elements without resorting to sketchy CSS selectors.
There's definitely a greater question of how we could look to render
<PortableTextInput>
in a style-agnostic fashion in future. For now, this is very much a short term solve.What to review
Nothing – this doesn't impact the studio...
Questions
.. but does lead to some interesting questions!
Nothing that needs to be actioned any time soon, but perhaps worth formalising eventually (especially as we start to see more PTE usage within the studio outside of document forms)
Testing
N/A
Notes for release
N/A