Skip to content

Tag is not working with DialogTrigger #8151

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

Open
Julienng opened this issue Apr 28, 2025 · 6 comments
Open

Tag is not working with DialogTrigger #8151

Julienng opened this issue Apr 28, 2025 · 6 comments
Labels
enhancement New feature or request

Comments

@Julienng
Copy link
Contributor

Julienng commented Apr 28, 2025

Provide a general summary of the issue here

Hi,

I'm trying to find a good implementation of a modal on top of a Tag / TagGroup components.

I have a list of tags that can be:

  • removed
  • added
  • edited

In the past, I used a custom Tag implementation (called Chip on our end) to handle this part, but the navigation control implemented by Tag/TagGroup is not easy to handle manually.

We are using RAC as our baseline component library and trying to find a fit for the Tag / TagGroup for that kind of use case.

Remove / Add is working great, the navigation inside TagGroup is wonderful, but I can't find a way to make Dialog / Modal work upon Tag for the editable part.

I'm open to discussing alternative patterns for this kind of use case if you have any ideas / recommendation

🤔 Expected Behavior?

I expect Tag to be a valid trigger element for DialogTrigger

😯 Current Behavior

The Modal is not working for Tag.

I extracted my tests here:
https://codesandbox.io/p/devbox/7x7mfz

As you can see, even controlled state for the modal has a weird behavior (modal is not closable, button are hidden from context)

💁 Possible Solution

I would love to enable this use case:

<TagList>
  <DialogTrigger>
    <Tag>my tag</Tag>
    <Modal>
      <Dialog>
      ...
      </Dialog>
    </Modal>
  </DialogTrigger>
</TagList>

🔦 Context

To explain further on my use case:

We have a list of badges associated with an asset.
A badge can be manual or calculated. Manual badge are editable by the user based on a selection of values configured for this badge.

Badges are represented as Chip / Tag is the UI.

🖥️ Steps to Reproduce

All my tests are here:
https://codesandbox.io/p/devbox/7x7mfz

  • first card: naive impl of tag with Dialog
  • second card: not that smart hack (controlled modal)
  • third card: control test (naive chip impl)

Version

1.8.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS 15.3.2

🧢 Your Company/Team

Semarchy

🕷 Tracking Issue

No response

@Julienng Julienng changed the title Tag component inside tag group is not working with DialogTrigger Tag is not working with DialogTrigger Apr 28, 2025
@snowystinger
Copy link
Member

Can you share more about your use case for this? Why/when is a Tag a DialogTrigger?

@Julienng
Copy link
Contributor Author

Julienng commented May 7, 2025

So the UI looks something like this:

Image

Users can: Add, Update and Delete Badge / Tags

The click on a Badge opens a modal with a "quick update" form

The click on a Tag opens a Preview Dialog, so the user can see some additional information.

Both of these depend on the "Tag" being "triggerable" by DialogTrigger

@dannify dannify added the enhancement New feature or request label May 7, 2025
@snowystinger
Copy link
Member

Talked about this in our weekly grooming. We think it's ok for Tags to support this interaction. Though we'd caution people against combining selection with dialog triggers, which is what it looks like you're doing.

The reason it's not working is because when the tag group is not selectable, then props from usePress are filtered out. So we'd need to allow those to still end up on the target and instead halt other interactions above that.

Here's where that is happening

allowsSelection || hasPrimaryAction || shouldUseVirtualFocus ? pressProps : {},

The first step would be to confirm the thesis here if you'd like to help out.

@Julienng
Copy link
Contributor Author

Julienng commented May 9, 2025

Hi, that's a wonderful news on our end! Thanks for looking into it.

Yeah we are in a case where the tag group is not selectable.

I would like to help on this but I've just started my holiday trip.
I'll come back to you after that (Mai 19-23)

@Julienng
Copy link
Contributor Author

Julienng commented May 9, 2025

Do you think an alternative where DialogTrigger accept a trigger ref make sense like (like the tooltip) ?

May it be easier ?

@snowystinger
Copy link
Member

The interaction combinations and interactions themselves would still be needed, otherwise you wouldn't know that a Tag had been clicked. I don't think we need to worry about a trigger ref pattern right now.

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

No branches or pull requests

3 participants