forked from basecamp/trix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes [basecamp#1023][] Integrate with `<form>` elements directly through built-in support for [ElementInternals][]. According to the [Form-associated custom elements][] section of [More capable form controls][], various behaviors that the `<trix-editor>` element was recreating are provided out of the box. For example, the `<label>` element support can be achieved through [ElementInternals.labels][]. Similarly, a `formResetCallback()` will fire whenever the associated `<form>` element resets. For now, keep the changes minimal. Future changes will handle integrating with more parts of `ElementInternals`. TODO after merging: --- - [ ] Integrate with [ElementInternals.willValidate](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate), [ElementInternals.validity](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/validity), [ElementInternals.validationMessage](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/validationMessage) - [ ] [Form callbacks](https://web.dev/articles/more-capable-form-controls#lifecycle_callbacks) like `void formDisabledCallback(disabled)` to support `[disabled]` - [ ] [Instance properties included from ARIA](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals#instance_properties_included_from_aria) [basecamp#1023]: basecamp#1023 [ElementInternals]: https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals [Form-associated custom elements]: https://web.dev/articles/more-capable-form-controls#form-associated_custom_elements [More capable form controls]: https://web.dev/articles/more-capable-form-controls [ElementInternals.setFormValue]: https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/setFormValue [ElementInternals.labels]: https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/labels
- Loading branch information
1 parent
457a834
commit 715a6c3
Showing
5 changed files
with
183 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
export default () => | ||
`<label id="label-1" for="editor"><span>Label 1</span></label> | ||
<label id="label-2"> | ||
Label 2 | ||
<trix-editor id="editor"></trix-editor> | ||
</label> | ||
<label id="label-3" for="editor">Label 3</label>` | ||
<label id="label-2">Label 2</label> | ||
<trix-editor id="editor"></trix-editor> | ||
<label id="label-3" for="editor">Label 3</label>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
export default () => | ||
`<form id="ancestor-form"> | ||
<trix-editor id="editor-with-ancestor-form"></trix-editor> | ||
<trix-editor id="editor-with-ancestor-form" name="editor-with-ancestor-form"></trix-editor> | ||
</form> | ||
<form id="input-form"> | ||
<input type="hidden" id="hidden-input"> | ||
</form> | ||
<trix-editor id="editor-with-input-form" input="hidden-input"></trix-editor> | ||
<trix-editor id="editor-with-no-form"></trix-editor>` | ||
<trix-editor id="editor-with-no-form"></trix-editor> | ||
<fieldset id="fieldset"><trix-editor id="editor-within-fieldset"></fieldset>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters