Commit 0c76135
fix(button): sync disabled state and type in renderHiddenButton (#31225)
Issue number: resolves #30968
---------
<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->
<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->
## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->
`<ion-button>` with type="submit" does not cause the associated `<form>`
to be submitted even though it is not disabled. When the text of the
input field is cleared and then input re-added, you can submit the
input.
## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
The visible and hidden button should always have the same disabled
state. `<ion-button>` with type="submit" should always submit the
associated `<form>` when it is enabled.
- Add `formButtonEl.disabled = this.disabled;` and `formButtonEl.type =
this.type;` to button.tsx in `renderHiddenButton()`. This addition syncs
the disabled status and type of the button when that happens.
- Add a test in to to
`packages/angular/test/base/e2e/src/lazy/form.spec.ts` which should
ensure any changes in button type are synced. The test gets the hidden
button type, changes the visible button state, and then expects the
hidden button state to change as well.
- Per conversations around this PR, testing disabled state sync will
need a dev build due to the nature of the issue.
## Does this introduce a breaking change?
- [ ] Yes
- [x] No
<!--
If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->
## Other information
<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
Related to a stencil update that affected when @watch('disabled') fires.
---------
Co-authored-by: Shane <shane@shanessite.net>1 parent a35f8a9 commit 0c76135
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
199 | 201 | | |
200 | 202 | | |
| 203 | + | |
| 204 | + | |
201 | 205 | | |
202 | 206 | | |
203 | 207 | | |
| |||
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
156 | 191 | | |
157 | 192 | | |
158 | 193 | | |
| |||
0 commit comments