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

Add another documentation isn't led by progressive enhancement #551

Open
gregtyler opened this issue Jan 10, 2024 · 0 comments
Open

Add another documentation isn't led by progressive enhancement #551

gregtyler opened this issue Jan 10, 2024 · 0 comments

Comments

@gregtyler
Copy link
Contributor

The Add another documentation and example are designed so that JavaScript is required. It mentions this:

The add another component relies on JavaScript. When JavaScript is not available, your page should reload with the additional form elements if the "Add another" button is pressed.

In real services we require all functionality to work without JavaScript, so this is not sufficient and we should update the documentation to start from a server-side approach and add the JavaScript functionality as a progressive enhancement.

The main changes needed to the example itself are:

  • Add a remove button with class moj-add-another__remove-button (JS doesn't add a new one if it already exists)
  • Add suitable name attributes to buttons so that the server-side can hook in

We should then document the server-side logic required, and then introduce what adding the JS functionality does.

I've set up an example project in Glitch to demo working server-side functionality.

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