8000 @uppy/dashboard: fix metafield form validation by aduh95 · Pull Request #3113 · transloadit/uppy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

@uppy/dashboard: fix metafield form validation #3113

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

Merged
merged 4 commits into from
Aug 19, 2021

Conversation

aduh95
Copy link
Contributor
@aduh95 aduh95 commented Aug 17, 2021

Browsers without support for the HTML form attribute would misbehave, making it impossible to validate the form at all, and potentially validate an unrelated upper form if users are embeding Uppy inside a a <form>.

FWIW this attribute is supported on all the browsers we officially support, but it's quite cheap to add a check and fallback to the old behavior if we don't detect any support.

It would be worth to backport this to Uppy 1.x, as we still support IE 11 there. There might also be another bug related to Preact 8 on that branch, as it seems the form attribute is not added at all to the DOM elements, so we should do some extra check before releasing a patch version.

Fixes: #3111

Browsers without support for the HTML `form` attribute would misbehave,
making it impossible to validate the form at all, and potentially validate an
unrelated upper form if users are embeding Uppy inside a a `<form>`.

Fixes: transloadit#3111
@arturi arturi self-requested a review August 17, 2021 17:16
@@ -154,6 +166,7 @@ class FileCard extends Component {
<button
className="uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn"
type="submit"
in HTMLButtonElement.prototype ? undefined : this.handleSave}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be a case where a comment with some context will help future contributors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of bd7ca31? Open to better suggestions if that do not suffice.

@arturi arturi merged commit 1f0e7a5 into transloadit:main Aug 19, 2021
@aduh95 aduh95 deleted the form-validation-events branch August 19, 2021 14:19
arturi pushed a commit that referenced this pull request Aug 19, 2021
* @uppy/dashboard: fix metafield form validation

Browsers without support for the HTML `form` attribute would misbehave,
making it impossible to validate the form at all, and potentially validate an
unrelated upper form if users are embeding Uppy inside a a `<form>`.

Fixes: #3111

* Add comments

* Fix docs and types
arturi added a commit that referenced this pull request Aug 19, 2021
Bug introduced in #2896, fix in #3113 didn’t work for uppy 1.x, because Preact 8 ignores the form attribute. We’ve removed the use of form for 1.x, so you still get the required meta field functionality, but no feedback from the browser

Co-Authored-By: Antoine du Hamel <14309773+aduh95@users.noreply.github.com>
Murderlon added a commit that referenced this pull request Aug 25, 2021
* main: (23 commits)
  Release
  Set node version in `workflows/cdn.yml` to 16.x
  Release
  build: add stylelint (#3124)
  Core: rename allowMultipleUploads to allowMultipleUploadBatches (#3115)
  meta: enforce `no-unused-vars` linter rule (#3118)
  writing-plugins: update example to use `i18nInit` (#3122)
  @uppy/core: reject empty string as valid value for required meta fields (#3119)
  Safely escape <script> injected code in companion `send-token.js` (#3101)
  @uppy/dashboard: fix metafield form validation (#3113)
  Clean up `BACKLOG.md` & add Vimeo as todo
  Add referrer to transloadit.com link (#3116)
  @uppy/locales latest version is 1.22.0 🙈
  Stricter linter (#3095)
  @uppy/aws-s3: refactor to use private fields (#3094)
  build: fix legacy bundle (#3112)
  Fix locales — point to CDN v1.31.0
  Fix typo in `docs/companion.md`
  Changelog for 1.31.0 and patches
  Strictly type uppy events (#3085)
  ...
vymao pushed a commit to vymao/uppy that referenced this pull request Mar 29, 2022
* @uppy/dashboard: fix metafield form validation

Browsers without support for the HTML `form` attribute would misbehave,
making it impossible to validate the form at all, and potentially validate an
unrelated upper form if users are embeding Uppy inside a a `<form>`.

Fixes: transloadit#3111

* Add comments

* Fix docs and types
vymao pushed a commit to vymao/uppy that referenced this pull request Mar 29, 2022
Bug introduced in transloadit#2896, fix in transloadit#3113 didn’t work for uppy 1.x, because Preact 8 ignores the form attribute. We’ve removed the use of form for 1.x, so you still get the required meta field functionality, but no feedback from the browser

Co-Authored-By: Antoine du Hamel <14309773+aduh95@users.noreply.github.com>
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.

submit meta fields do nothing
3 participants
0