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

[360] Use submit event for form submission #361

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chicharr
Copy link
Collaborator

Description

Form block uses

Related Issue

#360

Motivation and Context

Forms are submitted by a listener on the click event of the submit button. The payload is generated and POST'ed as a json via fetch API. This prevents the triggering of the submit event.

This behaviour prevents other features such as RUM or Conversion tracking to work automatically, as they listen to submit events

How Has This Been Tested?

  • Run the project locally.
  • On chrome browser open: https://www.hlx.live/developer/forms
  • Open developer tools -> Console and add a submit listener on the form element. document.getElementsByTagName('form')[0].addEventListener('submit', (e) => {console.log('form submitted');})
  • Scroll down to the sample form in the page, enter some data and click submit button.
  • Validate that in the browser Console, there is a message form submitted
  • Check that POST fetch request is still sent
  • Check that redirection after submit is still happening

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aem-code-sync
Copy link

aem-code-sync bot commented Aug 21, 2023

Hello, I'm Franklin Bot and I will run some test suites that validate the page speed.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-run PSI Checks

@aem-code-sync
Copy link

aem-code-sync bot commented Aug 21, 2023

Page Scores Audits Google
/developer/forms PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
/developer/example-form/thank-you PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@trieloff
Copy link
Contributor

hte5au4a336a

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

Successfully merging this pull request may close these issues.

None yet

2 participants