spectrum-web-components icon indicating copy to clipboard operation
spectrum-web-components copied to clipboard

[Bug]: Overlay Trigger creates an infinite callback loop in Angular (after migrating 0.29.0 -> 0.40.0)

Open SavoInfostream opened this issue 1 year ago • 3 comments

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

304d0f6f-2306-4c74-9dc8-279acfaadf66

What browsers are you seeing the problem in?

Firefox, Chrome, Safari, Microsoft Edge

How can we reproduce this issue?

  1. Create a new Angular project
  2. Add "@spectrum-web-components/bundle": "0.40.0" to package.json, and run npm install
  3. Add schemas: [CUSTOM_ELEMENTS_SCHEMA], to app.component.ts declaration
  4. 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.
  5. Run npm start in root directory to start the app.
  6. Try to open the page.

Sample code that illustrates the problem

Angular project: untitled.zip

Logs taken while reproducing problem

logs.txt

SavoInfostream avatar Nov 24 '23 12:11 SavoInfostream

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>

Westbrook avatar Nov 24 '23 22:11 Westbrook

That code works. Thanks :)

SavoInfostream avatar Nov 24 '23 22:11 SavoInfostream

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): Recording 2023-11-28 103613

SavoInfostream avatar Nov 28 '23 09:11 SavoInfostream

original issue fixed. Overlay flickering needs a separate issue.

najikahalsema avatar Aug 07 '24 17:08 najikahalsema