Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1d4c704
fix(ion-button): sync disabled state in ion-button renderHiddenButton
Zac-Smucker-Bryan Jun 17, 2026
2964bc6
test(ion-button): add e2e test for async disabled state change (issue…
Zac-Smucker-Bryan Jun 17, 2026
31aff31
npm run lint.fix
Zac-Smucker-Bryan Jun 17, 2026
c235b79
revert: fix(ion-button): sync disabled state in ion-button renderHidd…
Zac-Smucker-Bryan Jun 18, 2026
5fb20dd
revert: test(ion-button): add e2e test for async disabled state chang…
Zac-Smucker-Bryan Jun 18, 2026
963ae43
test(button): add e2e test for async disabled state change
Zac-Smucker-Bryan Jun 20, 2026
fb1d9f6
fix(button): sync disabled state in renderHiddenButton
Zac-Smucker-Bryan Jun 20, 2026
a96a6b5
revert: test(button): add e2e test for async disabled state change
Zac-Smucker-Bryan Jun 22, 2026
09a65ce
style: code comment
Zac-Smucker-Bryan Jun 23, 2026
914a42c
test(button): add e2e test for async disabled state change
Zac-Smucker-Bryan Jun 23, 2026
869ccd6
style
Zac-Smucker-Bryan Jun 23, 2026
2c78cd0
revert: test(ion-button): add e2e test for async disabled state change
Zac-Smucker-Bryan Jun 23, 2026
7e25d02
revert: test(ion-button): add e2e test for async disabled state change
Zac-Smucker-Bryan Jun 23, 2026
26b8aae
style
Zac-Smucker-Bryan Jun 23, 2026
fb273ab
Merge branch 'zsb-ionic-framework-clean' of https://github.com/Zac-Sm…
Zac-Smucker-Bryan Jun 23, 2026
4e9c622
test(button): add e2e test for async type change
Zac-Smucker-Bryan Jun 25, 2026
974ed1a
test(button): move e2e type sync test from ng to core
Zac-Smucker-Bryan Jun 26, 2026
5dac962
style update in form.spec.ts
Zac-Smucker-Bryan Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion core/src/components/button/button.tsx
Comment thread
thetaPC marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,13 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf

/**
* If the form already has a rendered form button
* then do not append a new one again.
* then do not append a new one again. Sync the
* disabled state and type if it changes after button
* creation (e.g., runtime property updates).
*/
if (formButtonEl !== null && formEl.contains(formButtonEl)) {
formButtonEl.disabled = this.disabled;
formButtonEl.type = this.type;
return;
}

Expand Down
35 changes: 35 additions & 0 deletions core/src/components/button/test/form-reference/button.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,41 @@ configs({ directions: ['ltr'], modes: ['ios'] }).forEach(({ title, config }) =>

expect(submitEvent).toHaveReceivedEvent();
});

test('should keep hidden button type in sync with visible button', async ({ page }) => {
// Set the form to have a submit button
await page.setContent(
`
<form id="myForm"></form>
<ion-button form="myForm" type="submit">
Submit
</ion-button>
`,
config
);

// Get visible button
const button = page.locator('ion-button');

// Get type of the hidden button
const getHiddenType = () =>
page.evaluate(() => {
const hidden = document.querySelector('form button[style*="display: none"]') as HTMLButtonElement;

return hidden?.type;
});

// Type of hidden button should be submit to start
expect(await getHiddenType()).toBe('submit');

// Set type of visible button to reset
await button.evaluate((el: HTMLIonButtonElement) => {
el.type = 'reset';
});

// Expect hidden button type to be reset
await expect.poll(async () => await getHiddenType()).toBe('reset');
});
});

test.describe(title('should throw a warning if the form cannot be found'), () => {
Expand Down
Loading