postlight / trimmings

🌲 Get back to HTML.
https://postlight.github.io/trimmings
Apache License 2.0
221 stars 7 forks source link

"Auto" feature #1

Open johnholdun opened 5 years ago

johnholdun commented 5 years ago

Automatically interact with something after a specified duration, or when it comes into view. Useful for automatic data refreshes and infinite scroll.

snellingio commented 5 years ago

Can see this being super useful for a "toast" or flash feature as well to remove it from the dom.

weavermedia commented 4 years ago

@snellingio Yeah, really like that idea. There is a Remove action already, would that be confusing?

Or maybe Remove could be extended to accept a delay value. If no delay value is provided it waits for a click (current behavior) but if delay is provided it removes on either a click or after the delay time 🤔

johnholdun commented 4 years ago

Or maybe Remove could be extended to accept a delay value.

I think another way to handle this is to add this hypothetical "auto" directive to a button that also has a "remove" directive. This button could be displayed to the user as a dismiss option for the alert in case they want to dismiss it more quickly; if they don't, after the specified delay, the button would receive a click event, which then triggers the remove and removes the alert from the DOM.