You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
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.
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).
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 tosp-tooltip
?Mockups or screenshots
No response
Implementation notes or ideas
No response
The text was updated successfully, but these errors were encountered: