Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding attributes with loading-states extension #2533

Open
tapegram opened this issue May 6, 2024 · 0 comments
Open

Adding attributes with loading-states extension #2533

tapegram opened this issue May 6, 2024 · 0 comments

Comments

@tapegram
Copy link

tapegram commented May 6, 2024

Problem

I'm using shoelace buttons where you just add a loading attribute to get the library's loading behavior.

It would be really nice if loading-states was flexible enough to add/remove attributes when requests are in flight, the same as with classes.

Proposal

Locally, I made a copy of the extension and added this:

loadingStateEltsByType['data-loading-attribute'].forEach(
					function (sourceElt) {
						getLoadingTarget(sourceElt).forEach(function (targetElt) {
							queueLoadingState(
								sourceElt,
								targetElt,
								function() { targetElt.loading = true },
                                                                  function() { targetElt.loading = false }
							)
						})
					}
				)

And it works great for me working with shoelace. But I was wondering if it might make sense to allow this extension to add/remove custom attributes, for cases such as this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant