Fix MarkdownEditor preview button incorrectly triggered form submit event
Changelog
When the MarkdownEditor was placed inside a form:
<form>
<MarkdownEditor />
</form>
The preview tab button of the MarkdownEditor would unintentionally trigger the form submit event when clicked, as the button element, by default, has a submit type.
The missing value default and invalid value default are the Submit Button state. HTML Standard - the button element
This PR fixes this issue by explicitly setting the type attribute of the Preview/Write button to be button.
<button type="button" role="tab" aria-selected="true" tabindex="0">Write</button>
<button type="button" role="tab" aria-selected="false" tabindex="-1">Preview</button>
Changed
- The "Preview" and "Write" button elements would have attributed
type="button"set.
Rollout strategy
- [x] Patch release
- [ ] Minor release
- [ ] Major release; if selected, include a written rollout or migration plan
Merge checklist
- [x] Added/updated tests
- [ ] Added/updated documentation
- [ ] Added/updated previews (Storybook)
- [x] Changes are SSR compatible
- [x] Tested in Chrome
- [ ] Tested in Firefox
- [ ] Tested in Safari
- [ ] Tested in Edge
- [ ] Integration tests pass at github/github (Learn more about how to run integration tests)
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.
🦋 Changeset detected
Latest commit: c824330c2f34e71cc60e98ebc4eb3f1090d4ab43
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @primer/react | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
hi @mperrotti, did you get a chance to look it? let me know if there is anything I can help
@mperrotti thanks for the review. Could this be merge and released?
Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.
hi @mperrotti , any chance to review this?
Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.