use event.target.value in Generators.input #1808
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently when you wrap an interactive element in a
div
, maybe for aesthetic reasons, or because you want to add a title, use theresize
helper, etc., you can't useGenerators.input
to read the value — or you need to copy the value somehow to the top-level element, as we do in Plot with thefigure
element.This, even though the
input
event bubbles up, which makesGenerators.input
slightly inconsistent.This change makes Generators.input read the value on the
input
event’s target, making the most of theinput
event.Note: if there are several inputs inside the "chart", so that whichever input (chart) you're touching returns its value. To combine values, you still need to use Inputs.form (but maybe Inputs.form could benefit from the same treatment?)
(OP: #1806 (reply in thread))
Leaving as a draft as there may be unwanted consequences that I'm not seeing. Though I guess a developer should explicitly opt out of event bubbling if they don't want to expose the input up in the hierarchy?