🏠 back to Observable

What is the best way to make range slider update only on release?

I was wondering what is currently the best way to update from an Inputs.range slider only on ‘release’ of the slider?

I see this cautious input example that uses the pre-Inputs version of a slider. Is this the way to go or are there better, possibly more compact approaches?

I would consider upvoting this issue:

Here’s a snippet you can use for a similar “cautious” range input:

viewof x = Object.assign(Inputs.range(), {
  oninput: event => event.isTrusted && event.stopImmediatePropagation(),
  onchange: event => event.currentTarget.dispatchEvent(new Event("input"))
})
2 Likes

Thanks very much. Edited: Removed earlier response that suggested options were being ignored (stupid mistake on my part in placing the options in the wrong object).

1 Like

works for me? updateOnRelease

1 Like

@mootari, @Job and I ended up writing a reusable wrapper for the usecase where you want to click a button to send forth the value(s).

Composing viewofs with the view literal / Tom Larkworthy / Observable (it fuses some of the ideas here too, note thats a link to the cautious section within the notebook)

1 Like