spectrum-web-components
spectrum-web-components copied to clipboard
[Bug]: Overlay Trigger creates an infinite callback loop in Angular (after migrating 0.29.0 -> 0.40.0)
Code of conduct
- [X] I agree to follow this project's code of conduct.
Impacted component(s)
Overlay Trigger
Expected behavior
For Angular (v15) app to work like it did int v0.29
Actual behavior
Total freeze of the page.
Screenshots
What browsers are you seeing the problem in?
Firefox, Chrome, Safari, Microsoft Edge
How can we reproduce this issue?
- Create a new Angular project
- Add
"@spectrum-web-components/bundle": "0.40.0"
to package.json, and runnpm install
- Add
schemas: [CUSTOM_ELEMENTS_SCHEMA],
to app.component.ts declaration - Add
<overlay-trigger type="modal"> <sp-button slot="trigger" variant="secondary">Toggle menu</sp-button> <sp-tray slot="click-content"> <sp-menu style="width: 100%"> <sp-menu-item selected>Deselect</sp-menu-item> <sp-menu-item>Select Inverse</sp-menu-item> <sp-menu-item focused>Feather...</sp-menu-item> <sp-menu-item>Select and Mask...</sp-menu-item> <sp-menu-divider></sp-menu-divider> <sp-menu-item>Save Selection</sp-menu-item> <sp-menu-item disabled>Make Work Path</sp-menu-item> </sp-menu> </sp-tray> </overlay-trigger>
to component template. - Run
npm start
in root directory to start the app. - Try to open the page.
Sample code that illustrates the problem
Angular project: untitled.zip
Logs taken while reproducing problem
Not sure the timing on spending more focused effort on this, but you might try the following DOM instead:
<sp-button id="trigger" variant="secondary">Toggle menu</sp-button>
<sp-overlay trigger="trigger@click">
<sp-tray>
<sp-menu style="width: 100%">
<sp-menu-item selected>Deselect</sp-menu-item>
<sp-menu-item>Select Inverse</sp-menu-item>
<sp-menu-item focused>Feather...</sp-menu-item>
<sp-menu-item>Select and Mask...</sp-menu-item>
<sp-menu-divider></sp-menu-divider>
<sp-menu-item>Save Selection</sp-menu-item>
<sp-menu-item disabled>Make Work Path</sp-menu-item>
</sp-menu>
</sp-tray>
</sp-overlay>
That code works. Thanks :)
Also, there's flickering on animation of the overlay (did three takes in the screenshot because recording fps wasn't big enugh to catch it every time):
original issue fixed. Overlay flickering needs a separate issue.