Trendyol / baklava

Baklava is a design system provided by Trendyol to create a consistent UI/UX for app users.
https://baklava.design/
MIT License
1.28k stars 115 forks source link

Events must be cancelable #598

Open Enes5519 opened 1 year ago

Enes5519 commented 1 year ago

Is your feature request related to a problem? Please describe. We cannot cancel the events created by the baklava.

For example: I am using Alert component to create notification component. I am creating the close button using the 'closable' attribute of the alert component. When the user clicks the close button, the Alert component sets itself to 'display: none' but I don't want this approach because I'm using animation. I would like to use 'preventDefault' to avoid this approach.

The same approach is required for components such as checkbox and switch.

Describe the solution you'd like Create events with 'cancellable' true. Baklava handles cancellable events.

muratcorlu commented 1 year ago

Good point. We already had a similar request for dialog with #564 and already created a PR for that. I think we need to consider similar events for some other components.

I see some potential use cases like:

Also, these can be potential use cases that I don't have any examples in my mind:

I think we need to consider all of those use cases separately and check UX side effects of preventing those actions. For example, we considered adding an animation to Dialog in case of close prevention to give the user feedback about this action. Otherwise, the user may think that the action is not working as a bug. So, I believe, we need to check if we have a proper, common feedback mechanism for preventing those events. If not, we can of course just delegate this responsibility to the developers.

@buseselvi Maybe we can consider planning a discussion on this topic. Or please just share your opinions as well.

muratcorlu commented 1 year ago

@Enes5519 does it make sense to close this issue with a conclusion to consider adding or converting some specific cancellable events, instead of making every event cancellable? so we can open separate issues per request.

buseselvi commented 1 year ago

I think we can talk about this at the Design Meeting on Tuesday, then we can share the outcomes here. Until then, we can think of and research these use cases above.