diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index e60361a1..b088a673 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -35,6 +35,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Added the `handle-icon` part to `` - Added `caret`, `check`, `grip-vertical`, `indeterminate`, and `radio` icons to the system library and removed `check-lg` [#985](https://github.com/shoelace-style/shoelace/issues/985) - Added the `loading` attribute to `` to allow lazy loading of image avatars [#1006](https://github.com/shoelace-style/shoelace/pull/1006) +- Added `formenctype` attribute to `` [#1009](https://github.com/shoelace-style/shoelace/pull/1009) - Added `exports` to `package.json` and removed the `main` and `module` properties [#1007](https://github.com/shoelace-style/shoelace/pull/1007) - Fixed a bug in `` that prevented the border radius to apply correctly to the header [#934](https://github.com/shoelace-style/shoelace/pull/934) - Fixed a bug in `` where the inner border disappeared on focus [#980](https://github.com/shoelace-style/shoelace/pull/980) diff --git a/src/components/button/button.ts b/src/components/button/button.ts index 191a5cd3..8191a15e 100644 --- a/src/components/button/button.ts +++ b/src/components/button/button.ts @@ -116,6 +116,10 @@ export default class SlButton extends ShoelaceElement implements ShoelaceFormCon /** Used to override the form owner's `action` attribute. */ @property({ attribute: 'formaction' }) formAction: string; + /** Used to override the form owner's `enctype` attribute. */ + @property({ attribute: 'formenctype' }) + formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain'; + /** Used to override the form owner's `method` attribute. */ @property({ attribute: 'formmethod' }) formMethod: 'post' | 'get'; diff --git a/src/internal/form.ts b/src/internal/form.ts index 8089a943..042cc6d9 100644 --- a/src/internal/form.ts +++ b/src/internal/form.ts @@ -234,7 +234,7 @@ export class FormSubmitController implements ReactiveController { // Pass form attributes through to the temporary button if (invoker) { - ['formaction', 'formmethod', 'formnovalidate', 'formtarget'].forEach(attr => { + ['formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach(attr => { if (invoker.hasAttribute(attr)) { button.setAttribute(attr, invoker.getAttribute(attr)!); }