Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 087b2fc

Browse files
Googlernshahan
authored andcommitted
Automated g4 rollback of changelist 205179702.
*** Reason for rollback *** Broken build targets *** Original change description *** Introduce a new attribute input on popup source directive to decide whether to set the popup related aria attributes. This defaults to true and should be turned off for the popup source in select components where the popup source isn't the click target. *** PiperOrigin-RevId: 205180546
1 parent c50eb0c commit 087b2fc

File tree

4 files changed

+13
-35
lines changed

4 files changed

+13
-35
lines changed

lib/src/laminate/popup/dom_popup_source.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ class DomPopupSourceFactory {
2828
/// Returns a new [DomPopupSource] from [sourceElement].
2929
DomPopupSource createPopupSource(HtmlElement sourceElement,
3030
{Alignment alignOriginX = Alignment.Start,
31-
Alignment alignOriginY = Alignment.Start,
32-
bool initAriaAttributes = true}) {
31+
Alignment alignOriginY = Alignment.Start}) {
3332
return new DomPopupSource(_asyncMeasureSize, sourceElement,
34-
alignOriginX: alignOriginX,
35-
alignOriginY: alignOriginY,
36-
initAriaAttributes: initAriaAttributes);
33+
alignOriginX: alignOriginX, alignOriginY: alignOriginY);
3734
}
3835

3936
/// Returns a stream of client sizes for [element], and offsets with the
@@ -57,22 +54,15 @@ class DomPopupSource implements ElementPopupSource {
5754

5855
final AsyncMeasureSize<HtmlElement> _asyncMeasureSize;
5956
final HtmlElement sourceElement;
60-
final bool _initAriaAttributes;
6157

6258
/// Creates a new source from a measure function and source DOM element.
6359
///
6460
/// Setting [alignOriginX] and [alignOriginY] is used for calculating what
6561
/// the x and y position should be.
66-
///
67-
/// [initAriaAttributes] decides whether to set the popup related aria
68-
/// attributes. This defaults to true and can be set to false for cases where
69-
/// the popup source isn't the focus target.
7062
DomPopupSource(this._asyncMeasureSize, this.sourceElement,
7163
{Alignment alignOriginX = Alignment.Start,
7264
Alignment alignOriginY = Alignment.Start,
73-
Point transform = const Point(0, 0),
74-
bool initAriaAttributes = true})
75-
: _initAriaAttributes = initAriaAttributes {
65+
Point transform = const Point(0, 0)}) {
7666
_alignOriginX = alignOriginX;
7767
_alignOriginY = alignOriginY;
7868
}
@@ -99,7 +89,7 @@ class DomPopupSource implements ElementPopupSource {
9989

10090
@override
10191
set popupId(String id) {
102-
if (id == null || !_initAriaAttributes) return;
92+
if (id == null) return;
10393
sourceElement
10494
..setAttribute('aria-owns', id)
10595
..setAttribute('aria-haspopup', 'true');

lib/src/laminate/popup/popup_source_directive.dart

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import 'package:angular_components/focus/focus_interface.dart';
1111
import 'package:angular_components/laminate/enums/alignment.dart';
1212
import 'package:angular_components/src/laminate/popup/dom_popup_source.dart';
1313
import 'package:angular_components/src/laminate/popup/popup_source.dart';
14-
import 'package:angular_components/utils/angular/properties/properties.dart';
1514
import 'package:angular_components/utils/angular/reference/reference.dart';
1615

1716
/// A directive that exposes the [PopupSource] interface as `popupSource`.
@@ -24,7 +23,6 @@ import 'package:angular_components/utils/angular/reference/reference.dart';
2423
class PopupSourceDirective
2524
implements ElementPopupSource, AfterViewInit, OnDestroy {
2625
final DomPopupSourceFactory _domPopupSourceFactory;
27-
final bool _initAriaAttributes;
2826
HtmlElement _element;
2927
ReferenceDirective _referenceDirective;
3028
Focusable _focusable;
@@ -35,17 +33,8 @@ class PopupSourceDirective
3533
PopupSource _popupSource;
3634
String _popupId;
3735

38-
/// [initPopupAriaAttributes] is an attribute input that decide whether to
39-
/// set the popup related aria attributes. This defaults to true and can be
40-
/// set to false for cases where the popup source isn't the focus target.
41-
PopupSourceDirective(
42-
this._domPopupSourceFactory,
43-
this._element,
44-
@Optional() this._referenceDirective,
45-
@Optional() this._focusable,
46-
@Attribute('initPopupAriaAttributes') String initAriaAttributes)
47-
: _initAriaAttributes =
48-
attributeToBool(initAriaAttributes, defaultValue: true);
36+
PopupSourceDirective(this._domPopupSourceFactory, this._element,
37+
@Optional() this._referenceDirective, @Optional() this._focusable);
4938

5039
@override
5140
ngOnDestroy() {
@@ -127,10 +116,11 @@ class PopupSourceDirective
127116
}
128117

129118
void _updateSource() {
130-
_popupSource = _domPopupSourceFactory.createPopupSource(_element,
131-
alignOriginX: _alignOriginX,
132-
alignOriginY: _alignOriginY,
133-
initAriaAttributes: _initAriaAttributes);
119+
_popupSource = _domPopupSourceFactory.createPopupSource(
120+
_element,
121+
alignOriginX: _alignOriginX,
122+
alignOriginY: _alignOriginY,
123+
);
134124

135125
if (_popupId != null) {
136126
_popupSource.popupId = _popupId;

lib/src/material_tooltip/tooltip_source.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ class MaterialTooltipSourceDirective extends PopupSourceDirective
5555
domPopupSourceFactory,
5656
element,
5757
/* referenceDirective */ null,
58-
/* focusable */ null,
59-
/* initAriaAttributes */ null) {
58+
/* focusable */ null) {
6059
_show = new DelayedAction(tooltipShowDelay, activate);
6160
}
6261

lib/src/material_tooltip/tooltip_target.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ abstract class TooltipTarget extends PopupSourceDirective {
193193
domPopupSourceFactory,
194194
_element,
195195
/* referenceDirective */ null,
196-
/* focusable */ null,
197-
/* initAriaAttributes */ null);
196+
/* focusable */ null);
198197

199198
/// Sets the tooltip associated with this target.
200199
void setTooltip(Tooltip component) {

0 commit comments

Comments
 (0)