mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 05:42:36 +08:00
The composer field type backed its value with an `<input type="hidden">`, which the HTML spec excludes from constraint validation. `required` had no effect there, and the component never set it in the first place: it only read `validations.required` to draw the asterisk. `form.checkValidity()` therefore always passed for these fields. When the composer field was the only one in the template, the generated post body came out empty and submission was stopped by a falsy-string check with no visible error. When other fields had content, the body was non-empty and the topic was created with the required field still blank. Backs the field with a visually hidden text input carrying `required`, as every other field type does, and dispatches an `input` event on it when the editor changes so the shared validation logic can clear the error tip. That input is `aria-hidden`, so the invalid state and the error tip attached to it were unreachable by assistive technology. It is now treated as a validation proxy: its state is mirrored onto the real editor through `aria-invalid` and `aria-describedby`, the message is announced through the `a11y` service, and the editor is labelled by the field label. Switching between markdown and rich modes replaces the editor element, so that state is reapplied rather than toggled in place. |
||
|---|---|---|
| .. | ||
| base | ||
| components | ||
| float-kit | ||
| form-kit | ||
| foundation | ||
| login | ||
| modal | ||
| rich-editor | ||
| select-kit | ||
| table-builder | ||
| upcoming-changes | ||
| d-editor.scss | ||
| font-variables.scss | ||
| input_tip.scss | ||
| loading-slider.scss | ||
| nested-view.scss | ||
| post-action-feedback.scss | ||
| printer-friendly.scss | ||
| software-update-prompt.scss | ||
| tokens.scss | ||
| toolbar-popup-menu-options.scss | ||
| topic-entrance.scss | ||
| topic-timeline.scss | ||
| whcm.scss | ||