-
Notifications
You must be signed in to change notification settings - Fork 158
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(masthead): introduce web components #2960
feat(masthead): introduce web components #2960
Conversation
This change introduces Web Components version of masthead (L0). This change also introduces: * `lit-html` version of the icons defined in `@carbon/ibmdotcom-styles`. To do this, needed to hoist `carbon-components`/`carbon-custom-elements` dependencies given `lit-html` version of the icons that is create on-the-fly in development time isn't tied to `packages/web-components` * Several mix-ins for masthead style rules. This required given they are under deeply nested selectors that are hard to define custom elements selectors alongside * `lit-staged` support for TypeScript files Refs carbon-design-system#2861.
@asudoh I was running into a similar problem on another branch, do you know what's causing this? |
dde7a04
to
f82ad7f
Compare
@jeffchew Do you have the CircleCI log link? My finding is that it's likely specific to this PR (introduction of latest |
f82ad7f
to
8c9bc06
Compare
Deploy preview created for package Built with commit: f84ee992bbd4695676b3607b25a04d5b9dd2e6df |
Thanks @jeffchew! Let's discuss further there. |
Looks great @asudoh! Are there knobs that we can set for the story, like platform name, etc? It might also be worth creating as separate stories too and treat as a variation. The masthead content below looks a little odd when you scroll down: |
@asudoh noticed a couple of things with the masthead search. It is supposed to overlay the entire header when opened, but is showing as this: Also, when using the search typeahead, it seems to take over the whole storybook screen and can't find a way back: |
37896ec
to
b403d00
Compare
b403d00
to
4a8bbbb
Compare
Thanks @jeffchew for reviewing! Added knobs for brand name and authentication state, and fixed the issues. |
c345ca0
to
1561052
Compare
Thanks @asudoh ! Looks much better! I am still seeing the black banding when scrolling down though on the page, not sure if that's a storybook thing or the masthead causing it? Also, I don't see the |
Thanks @jeffchew!
One question here; How did you make the Storybook itself black? I think reproducing the problem requiring to do so. given what I'm seeing is: |
Fixed the issue in operating system's dark mode (I guess newer Storybook supports |
As discussed, added documentation for analytics on how tag names and custom events can be used in Web Components to play the role of Also added missing |
Thank you @asudoh ! FYI, I have a separate issue for updating the README to be more adopter focused (#2916), so we an address some of these thoughts there:
|
|
||
## Web Components way for analytics | ||
|
||
`@carbon/ibmdotcom-react`, etc. libraries have `data-autoid` attributes in several places, to convey better context than raw HTML `<div>`, etc. tags and their attributes when analytics libraries captures bubbling events e.g. `click` on `<body>` and inspects `event.target`. |
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.
At minimum, should we add the data-autoid for the parent level tags? e.g. data-autoid="dds--masthead"
?
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.
We could do <dds-masthead data-autoid="dds--masthead">
. That said, <dds-masthead>
tag name seems to serve the purpose of data-autoid
, but did you meant that we'd want to duplicate it...?
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.
I'm wondering if for analytics they are tracking anything across different applications within IBM.com, and if they need to have that consistent stable selector language when going from one part of the site to another? So one IBM.com application is using React, another application is using web components, and another one is using vanilla. I might be overthinking it though.
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.
Yeah the thought overall makes sense. Given data-autoid
inside shadow DOM doesn't make event.target.dataset.audoId
work due to event retargeting as discussed, I thought that providing a new set of guidelines makes more sense instead of providing data-autoid
that makes it looks like "compatible" but not actually fully.
But if we want to go with "partial compatibility" route I'm all for it.
Thank you for another review @jeffchew! Good points:
Makes sense.
All makes sense - Updated. |
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.
Approving this, we can probably get in the stable selectors in a separate PR or maybe sneak this in before merging in. Thank you @asudoh !
Thank you @jeffchew for reviewing! Let's queue up stable selector thing. |
Related Ticket(s)
Refs #2861.
Description
This change introduces Web Components version of masthead (L0).
This change also introduces:
lit-html
version of the icons defined in@carbon/ibmdotcom-styles
. To do this, needed to hoistcarbon-components
/carbon-custom-elements
dependencies givenlit-html
version of the icons that is create on-the-fly in development time isn't tied topackages/web-components
lint-staged
support for TypeScript filesChangelog
New
lit-html
version of the icons defined in@carbon/ibmdotcom-styles
lint-staged
support for TypeScript filesChanged