fix(checkbox, radio): label is announced once on ios (#26770)

resolves #26769
This commit is contained in:
Liam DeBeasi
2023-02-09 12:36:29 -05:00
committed by GitHub
parent 52a9755ea5
commit 87bc749040
2 changed files with 27 additions and 19 deletions

View File

@ -247,6 +247,21 @@ export class Checkbox implements ComponentInterface {
})}
>
<label class="checkbox-wrapper">
{/*
The native control must be rendered
before the visible label text due to https://bugs.webkit.org/show_bug.cgi?id=251951
*/}
<input
type="checkbox"
aria-checked={`${checked}`}
disabled={disabled}
id={inputId}
onChange={this.toggleChecked}
onFocus={() => this.onFocus()}
onBlur={() => this.onBlur()}
ref={(focusEl) => (this.focusEl = focusEl)}
{...inheritedAttributes}
/>
<div
class={{
'label-text-wrapper': true,
@ -260,17 +275,6 @@ export class Checkbox implements ComponentInterface {
{path}
</svg>
</div>
<input
type="checkbox"
aria-checked={`${checked}`}
disabled={disabled}
id={inputId}
onChange={this.toggleChecked}
onFocus={() => this.onFocus()}
onBlur={() => this.onBlur()}
ref={(focusEl) => (this.focusEl = focusEl)}
{...inheritedAttributes}
/>
</label>
</Host>
);