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

[Feat]: sp-tag option to delete without removing from DOM #4104

Open
1 task done
adixon-adobe opened this issue Feb 29, 2024 · 3 comments
Open
1 task done

[Feat]: sp-tag option to delete without removing from DOM #4104

adixon-adobe opened this issue Feb 29, 2024 · 3 comments
Labels
enhancement New feature or request triage An issue needing triage

Comments

@adixon-adobe
Copy link
Collaborator

Code of conduct

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

Impacted component(s)

sp-tag

Description of the requested feature

We've seen some issues with the behavior of sp-tag on delete, and our framework which re-uses DOM elements -- we can get into a state where the framework is supposed to render an sp-tag, but it doesn't because it's been removed. While it's easy to add a preventDefault to the delete event, it's also an easy gotcha for new developers. The simplest improvement here would be to add an example to the docs where the deletion is handled automatically.

I'm writing this up as a feature request though so there can at least be some discussion of the philosophy here. I know in our application we want the button to be available, but we'd prefer to manage the DOM state ourselves. Maybe a self-managed attribute should be added similar to sp-tooltip?

Mockups or screenshots

No response

Implementation notes or ideas

No response

@adixon-adobe adixon-adobe added enhancement New feature or request triage An issue needing triage labels Feb 29, 2024
@Westbrook
Copy link
Collaborator

event.preventDefault() is the browsers API for preventing things and the main path to "controlling" an element. I'm not sure what sort of alternate API you'd want to see here that didn't diverge from the architecture established by the platform itself.

@adixon-adobe
Copy link
Collaborator Author

The one reason this continues to give me pause is that the default behavior can create subtle bugs, and that there aren't common html patterns where a DOM element removes itself.

@adixon-adobe
Copy link
Collaborator Author

I would also guess that in most use cases for this, clients need to actually persist the change somehow, and update an internal list of tags (at which point the element removing itself from the DOM is likely redundant).

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

No branches or pull requests

2 participants