Skip to content
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

[Bug]: Accordion: click into open (non-modal) overlay in accordion-item closes the overlay #4735

Open
1 task done
spdev3000 opened this issue Sep 10, 2024 · 4 comments
Open
1 task done
Labels

Comments

@spdev3000
Copy link
Collaborator

spdev3000 commented Sep 10, 2024

Code of conduct

  • I agree to follow this project's code of conduct.

Impacted component(s)

accordion-item, overlay

Expected behavior

If a click occurs in a default (non-modal) overlay content which is inside an accordion-item should not close the accordion-item (toggle) - it should keep the accordion item open.

Actual behavior

If a user clicks into a default (non-modal) overlay (and its content) which is inside an open accordion-item - that overlay closes immediately.

Screenshots

No response

What browsers are you seeing the problem in?

No response

How can we reproduce this issue?

  1. Go to studio example
  2. See first accordion item is open
  3. Click on button to trigger overlay
  4. Click into contained slider and try to adjust slider
  5. See overlay closes immediately

Sample code or abstract reproduction which illustrates the problem

I think due to the click inside of an accordion-item the focus is shifted back to accordion-item which causes the (type=auto) overlay to close.
A click inside an open overlay should not trigger the overlay content of the accordion-item to close.

Severity

None

Logs taken while reproducing problem

No response

@Rajdeepc
Copy link
Contributor

Do you feel that an overlay-trigger can be used since you are directly interacting with an persistent trigger element. I have readdressed your repro with overlay-trigger and i see the focus is getting trapped inside the slider and not closing the overlay.
https://studio.webcomponents.dev/edit/ADqqGnUgtfXZ49v7fal4/src/index.ts?p=stories

@spdev3000
Copy link
Collaborator Author

spdev3000 commented Sep 12, 2024

Yes a "modal" overlay can be used without loosing focus as this is the goal of a "modal" one. But our use case would require a default (type="auto") overlay to stay open even if clicked inside that overlay (or its content). Isn't there a way to evaluate which element is dispatching the click event and do nothing in case when it's coming from an overlay?

I have re-added my example in second accordion-item to see the difference. Using sp-overlay or overlay-trigger doesn't matter if having the same types (auto or modal).

@spdev3000 spdev3000 changed the title [Bug]: Accordion: click into open overlay in accordion-item closes the overlay [Bug]: Accordion: click into open (non-modal) overlay in accordion-item closes the overlay Sep 12, 2024
@Rajdeepc
Copy link
Contributor

Rajdeepc commented Sep 12, 2024

Currently type="auto" will not allow you to trap focus on any other element in focus. This was not designed to be a part of this api contract. You can use type="manual" instead like this:

<sp-overlay trigger="trigger@click" type="manual" placement="bottom">

https://opensource.adobe.com/spectrum-web-components/components/overlay/#manual

@spdev3000
Copy link
Collaborator Author

Yes we could use that, but what is the idea behind clicking in a open overlay and moving focus to the underlying accordion-item? I don't think users expect this behavior and I still see this as a bug of accordion-item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants