-
Notifications
You must be signed in to change notification settings - Fork 76
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
[calcite-flow-item] does not have a back button if within a shadow root #6237
Comments
Could be related to the utilities used, will need a refactor in the component to mitigate without the use of the utility functions. |
@ethanbdev I could be misinterpreting the issue, but from what I can recall, |
That makes sense, I think we are not using the flow-item quite correctly. But with the removal of the
If that is not supported we can adjust the structure or consider a different component, like a panel with a slotted action in the header. |
Allocating to the February release for further discussion. |
@ethanbdev Gotcha. In the above structure snippet, is the item in the same light DOM tree as the flow? If so, I think that would work. I believe Map Viewer has some components structured similarly. @AdelheidF can you confirm? |
It is not, all of our components utilize
|
calcite-flow-item
does not have a back button if within a shadow root
@ethanbdev Thanks for the info and apologies for the belated reply. 😅 We'll need to revisit the timeline for this while we do some research on the approach. FWIW, we prototyped something that could be used as the base for this: #4817 (comment). Did you find a workaround or is this still a high impact issue for you? |
I would very much like to use If I don't use |
I would say it has moved to a more moderate impact. The workaround is to use an undocumented, internal prop. We hope to change the structure of the components to not have the flow item in the shadow root, but I think it still felt like a regression when this behaviour changed |
It's possible I'm doing things wrong here, but with the calcite-components-react, I think the the flow item is always in a shadow root? And without the showBackButton attribute public anymore, I don't think it's possible to display a back button? E.g.
} |
I think we want to make sure parent/child components are within the same DOM and not separated by a shadowDOM so that they can work correctly. I think even native elements need to be like this to work and are accessible. I may be mistaken, but I don't think you can do a native |
**Related Issue:** #6237 ## Summary This enables `flow` to work with custom components using shadow DOM wrapping `flow-item`. Custom components will have to implement the [`FlowItemLike`](https://github.com/Esri/calcite-design-system/pull/7608/files#diff-82c222ab365cde13a1f1288d936611519dfd9bee1e283164b260ca554c04a191R3-R7) interface and set the new `custom-item-selectors`/`customItemSelectors` attr/prop to target custom components (see [E2E test](https://github.com/Esri/calcite-design-system/pull/7608/files#diff-9b86e64de24dfca441533c63ae0f6834bff10bffbde23fd8bb3989a2259e356cR315-R387) for vanilla JS example). **Note**: `customItemSelectors` is intentionally marked internal since we don't have any documentation yet on developing custom components, which this is meant to support. We could additionally hide `FlowItemLike` in the doc site to avoid confusion until we have more documentation on this use case. I'm open to suggestions on this. @geospatialem @macandcheese @driskull
Installed and assigned for verification. |
@ethanbdev @AdelheidF
Here's an example showing how you can do that with vanilla JS: https://codepen.io/jcfranco/pen/zYyBJEV. It should be much more straightforward w/ Stencil or similar tooling. Stencil component exampleimport { Component, Host, h, Prop, Method } from "@stencil/core";
import type { FlowItemLike } from "@esri/calcite-components/dist/types/components/flow/interfaces.d.ts";
@Component({
tag: 'custom-flow-item',
shadow: true,
})
export class CustomFlowItem implements FlowItemLike {
private flowItem: HTMLCalciteFlowItemElement;
@Prop() beforeBack: () => Promise<void>;
// not required by the interface, but adding to allow passing through to `calcite-flow-item`
@Prop() heading: string;
@Prop() menuOpen: boolean;
@Prop() showBackButton: boolean;
@Method() async setFocus(): Promise<void> {
await this.flowItem.setFocus();
};
render() {
return (
<Host>
<calcite-flow-item
beforeBack={this.beforeBack}
heading={this.heading}
menuOpen={this.menuOpen}
// @ts-ignore -- internal
showBackButton={this.showBackButton}
// eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
ref={el => this.flowItem = el}
>
<slot/>
</calcite-flow-item>
</Host>
);
}
} Note that the new prop and interface won't be available in the documentation until we have something covering custom element creation (no timeline on that). cc @geospatialem @macandcheese Let us know if you need any help or have any questions. Happy coding! ✨💻✨ |
Verified with the Codepen mentioned in Franco's post above. ☝🏻 |
The Error |
#7666 will split up the interface into:
I've also added a Stencil-based example for custom flow items in my previous comment. Technically, the custom item doesn't need to implement the interface for it to be picked up by flow, but it should to ensure APIs are in sync. |
Installed and assigned for verification. |
#7666 landed! 🛬 @AdelheidF Would you be able to help verify once |
Seems good with |
Closing per #6237 (comment). |
@AdelheidF Thanks for testing! 🙌 |
Actual Behavior
With
showBackButton
being internal and defaulting to false, by default a flow item within a shadow root is missing the back button, breaking the functionality of a flow item.Expected Behavior
It should show a back button when it is the active flow item
Reproduction Sample
https://codepen.io/eborgen/pen/vYaygZy
Reproduction Steps
Observe that with a structure that puts a shadow root boundary between the
calcite-flow
andcalcite-flow-item
, the back button does not render.Reproduction Version
next.707
Relevant Info
No response
Regression?
between beta.99 and next.707
Impact
High - it breaks the workflow unless I set an internal prop and ignore the type error
Esri team
ArcGIS Map Viewer
The text was updated successfully, but these errors were encountered: