Skip to content

Commit 35913a6

Browse files
asynclizcopybara-github
authored andcommitted
fix(dialog): buttons not reflecting value attribute when setting property
Fixes #5409 PiperOrigin-RevId: 600541901
1 parent fcdfa33 commit 35913a6

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

button/internal/button.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {ARIAMixinStrict} from '../../internal/aria/aria.js';
1414
import {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';
1515
import {
1616
FormSubmitter,
17-
type FormSubmitterType,
1817
setupFormSubmitter,
18+
type FormSubmitterType,
1919
} from '../../internal/controller/form-submitter.js';
2020
import {
2121
dispatchActivationClick,
@@ -78,9 +78,17 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
7878
@property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon =
7979
false;
8080

81+
/**
82+
* The default behavior of the button. May be "text", "reset", or "submit"
83+
* (default).
84+
*/
8185
@property() type: FormSubmitterType = 'submit';
8286

83-
@property() value = '';
87+
/**
88+
* The value added to a form with the button's name when the button submits a
89+
* form.
90+
*/
91+
@property({reflect: true}) value = '';
8492

8593
get name() {
8694
return this.getAttribute('name') ?? '';

iconbutton/internal/icon-button.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {ARIAMixinStrict} from '../../internal/aria/aria.js';
1616
import {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';
1717
import {
1818
FormSubmitter,
19-
type FormSubmitterType,
2019
setupFormSubmitter,
20+
type FormSubmitterType,
2121
} from '../../internal/controller/form-submitter.js';
2222
import {isRtl} from '../../internal/controller/is-rtl.js';
2323
import {
@@ -91,9 +91,17 @@ export class IconButton extends iconButtonBaseClass implements FormSubmitter {
9191
*/
9292
@property({type: Boolean, reflect: true}) selected = false;
9393

94+
/**
95+
* The default behavior of the button. May be "text", "reset", or "submit"
96+
* (default).
97+
*/
9498
@property() type: FormSubmitterType = 'submit';
9599

96-
@property() value = '';
100+
/**
101+
* The value added to a form with the button's name when the button submits a
102+
* form.
103+
*/
104+
@property({reflect: true}) value = '';
97105

98106
get name() {
99107
return this.getAttribute('name') ?? '';

0 commit comments

Comments
 (0)