Proposal: data-reflex-disable data-reflex-disable-with #229
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.
Feature
Description
When I was pairing with Nate on the params stuff, someone mentioned how it would be cool to have a
data-disable-with
like Rails has inrails-ujs
. (I think that's where it comes from? 🤔)This PR introduces:
data-reflex-disable
to disable an element when a reflex fires, and re-enables the element after the reflex completesdata-reflex-disable-with
to disable an element and update theinnerHTML
when a reflex fires, and re-enables and resetinnerHTML
when the reflex completesdata-reflex-disable
data-reflex-disable-with
Why should this be added
This would save callbacks solely for disabling/enabling elements (which we do a lot, currently, at Podia) and is in line with Rails functionality.
Why didn't you just name this
data-disable-with
?I don't want to interfere with Rails and I like that it's reflex-specific. If the consensus is that it should follow that name, I'm more than glad to update it. 🤗
Help!
This is a naive implementation, and currently only is tested on buttons.
Checklist