fix(dialog): buttons not reflecting value attribute when setting property

Fixes #5409

PiperOrigin-RevId: 600541901
This commit is contained in:
Elizabeth Mitchell 2024-01-22 12:48:16 -08:00 committed by Copybara-Service
parent fcdfa33a2e
commit 35913a6ea4
2 changed files with 20 additions and 4 deletions

View File

@ -14,8 +14,8 @@ import {ARIAMixinStrict} from '../../internal/aria/aria.js';
import {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';
import {
FormSubmitter,
type FormSubmitterType,
setupFormSubmitter,
type FormSubmitterType,
} from '../../internal/controller/form-submitter.js';
import {
dispatchActivationClick,
@ -78,9 +78,17 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
@property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon =
false;
/**
* The default behavior of the button. May be "text", "reset", or "submit"
* (default).
*/
@property() type: FormSubmitterType = 'submit';
@property() value = '';
/**
* The value added to a form with the button's name when the button submits a
* form.
*/
@property({reflect: true}) value = '';
get name() {
return this.getAttribute('name') ?? '';

View File

@ -16,8 +16,8 @@ import {ARIAMixinStrict} from '../../internal/aria/aria.js';
import {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';
import {
FormSubmitter,
type FormSubmitterType,
setupFormSubmitter,
type FormSubmitterType,
} from '../../internal/controller/form-submitter.js';
import {isRtl} from '../../internal/controller/is-rtl.js';
import {
@ -91,9 +91,17 @@ export class IconButton extends iconButtonBaseClass implements FormSubmitter {
*/
@property({type: Boolean, reflect: true}) selected = false;
/**
* The default behavior of the button. May be "text", "reset", or "submit"
* (default).
*/
@property() type: FormSubmitterType = 'submit';
@property() value = '';
/**
* The value added to a form with the button's name when the button submits a
* form.
*/
@property({reflect: true}) value = '';
get name() {
return this.getAttribute('name') ?? '';