/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Inject, Optional, InjectionToken, Directive, } from '@angular/core'; import { mixinDisabled } from '../common-behaviors/disabled'; import { MAT_OPTION_PARENT_COMPONENT } from './option-parent'; import * as i0 from "@angular/core"; // Notes on the accessibility pattern used for `mat-optgroup`. // The option group has two different "modes": regular and inert. The regular mode uses the // recommended a11y pattern which has `role="group"` on the group element with `aria-labelledby` // pointing to the label. This works for `mat-select`, but it seems to hit a bug for autocomplete // under VoiceOver where the group doesn't get read out at all. The bug appears to be that if // there's __any__ a11y-related attribute on the group (e.g. `role` or `aria-labelledby`), // VoiceOver on Safari won't read it out. // We've introduced the `inert` mode as a workaround. Under this mode, all a11y attributes are // removed from the group, and we get the screen reader to read out the group label by mirroring it // inside an invisible element in the option. This is sub-optimal, because the screen reader will // repeat the group label on each navigation, whereas the default pattern only reads the group when // the user enters a new group. The following alternate approaches were considered: // 1. Reading out the group label using the `LiveAnnouncer` solves the problem, but we can't control // when the text will be read out so sometimes it comes in too late or never if the user // navigates quickly. // 2. `\n {{ label }} \n\n\n\n", styles: [".mat-mdc-optgroup{color:var(--mat-optgroup-label-text-color);font-family:var(--mat-optgroup-label-text-font);line-height:var(--mat-optgroup-label-text-line-height);font-size:var(--mat-optgroup-label-text-size);letter-spacing:var(--mat-optgroup-label-text-tracking);font-weight:var(--mat-optgroup-label-text-weight)}.mat-mdc-optgroup-label{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;padding-left:16px;padding-right:16px;min-height:48px}.mat-mdc-optgroup-label:focus{outline:none}[dir=rtl] .mat-mdc-optgroup-label,.mat-mdc-optgroup-label[dir=rtl]{padding-left:16px;padding-right:16px}.mat-mdc-optgroup-label.mdc-list-item--disabled{opacity:.38}.mat-mdc-optgroup-label .mdc-list-item__primary-text{font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;white-space:normal}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatOptgroup, decorators: [{ type: Component, args: [{ selector: 'mat-optgroup', exportAs: 'matOptgroup', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['disabled'], host: { 'class': 'mat-mdc-optgroup', '[attr.role]': '_inert ? null : "group"', '[attr.aria-disabled]': '_inert ? null : disabled.toString()', '[attr.aria-labelledby]': '_inert ? null : _labelId', }, providers: [{ provide: MAT_OPTGROUP, useExisting: MatOptgroup }], template: "\n {{ label }} \n\n\n\n", styles: [".mat-mdc-optgroup{color:var(--mat-optgroup-label-text-color);font-family:var(--mat-optgroup-label-text-font);line-height:var(--mat-optgroup-label-text-line-height);font-size:var(--mat-optgroup-label-text-size);letter-spacing:var(--mat-optgroup-label-text-tracking);font-weight:var(--mat-optgroup-label-text-weight)}.mat-mdc-optgroup-label{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;padding-left:16px;padding-right:16px;min-height:48px}.mat-mdc-optgroup-label:focus{outline:none}[dir=rtl] .mat-mdc-optgroup-label,.mat-mdc-optgroup-label[dir=rtl]{padding-left:16px;padding-right:16px}.mat-mdc-optgroup-label.mdc-list-item--disabled{opacity:.38}.mat-mdc-optgroup-label .mdc-list-item__primary-text{font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;white-space:normal}"] }] }] }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0Z3JvdXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvY29yZS9vcHRpb24vb3B0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