Skip to content

Commit 934ded2

Browse files
authored
Fixed catch, query, and boundRect issues in Edge Classic and IE (#377)
1 parent 8c9e7c9 commit 934ded2

File tree

6 files changed

+31
-19
lines changed

6 files changed

+31
-19
lines changed

src/components/mgt-login/mgt-login.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export class MgtLogin extends MgtBaseComponent {
6161
* @type {MgtFlyout}
6262
* @memberof MgtLogin
6363
*/
64-
@query('.flyout') protected flyout: MgtFlyout;
64+
protected get flyout(): MgtFlyout {
65+
return this.renderRoot.querySelector('.flyout');
66+
}
6567

6668
/**
6769
* determines if login menu popup should be showing

src/components/mgt-people-picker/mgt-people-picker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
113113
* @type {MgtFlyout}
114114
* @memberof MgtLogin
115115
*/
116-
@query('.flyout') protected flyout: MgtFlyout;
116+
protected get flyout(): MgtFlyout {
117+
return this.renderRoot.querySelector('.flyout');
118+
}
117119

118120
// if search is still loading don't load "people not found" state
119121
@property({ attribute: false }) private _showLoading: boolean;
@@ -469,7 +471,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
469471
try {
470472
const graph = provider.graph.forComponent(this);
471473
this._groupPeople = await getPeopleFromGroup(graph, this.groupId);
472-
} catch {
474+
} catch (_) {
473475
this._groupPeople = [];
474476
}
475477
}

src/components/mgt-person/mgt-person.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ export class MgtPerson extends MgtTemplatedComponent {
173173
* @type {MgtFlyout}
174174
* @memberof MgtPerson
175175
*/
176-
@query('.flyout') protected flyout: MgtFlyout;
176+
protected get flyout(): MgtFlyout {
177+
return this.renderRoot.querySelector('.flyout');
178+
}
177179

178180
@property({ attribute: false }) private _personCardShouldRender: boolean;
179181
private _personDetails: IDynamicPerson;

src/components/mgt-teams-channel-picker/mgt-teams-channel-picker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ export class MgtTeamsChannelPicker extends MgtTemplatedComponent {
180180
}
181181

182182
// User input in search
183-
@query('.team-chosen-input') private _input: HTMLInputElement;
183+
private get _input(): HTMLInputElement {
184+
return this.renderRoot.querySelector('.team-chosen-input');
185+
}
184186
private _inputValue: string = '';
185187

186188
private _isFocused = false;

src/components/sub-components/mgt-flyout/mgt-flyout.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ export class MgtFlyout extends LitElement {
8484
// if the flyout is opened once, this will keep the flyout in the dom
8585
private _renderedOnce = false;
8686

87-
@query('.flyout') private _flyout: HTMLElement;
88-
@query('.anchor') private _anchor: HTMLElement;
87+
private get _flyout(): HTMLElement {
88+
return this.renderRoot.querySelector('.flyout');
89+
}
90+
private get _anchor(): HTMLElement {
91+
return this.renderRoot.querySelector('.anchor');
92+
}
8993

9094
private _isOpen: boolean;
9195

@@ -261,14 +265,14 @@ export class MgtFlyout extends LitElement {
261265
// center in between
262266
left = (windowRect.width - flyoutRect.width) / 2;
263267
}
264-
} else if (anchorRect.x + flyoutRect.width + this._edgePadding > windowRect.width) {
268+
} else if (anchorRect.left + flyoutRect.width + this._edgePadding > windowRect.width) {
265269
// it will render off screen to the right, move to the left
266-
left = anchorRect.x - (anchorRect.x + flyoutRect.width + this._edgePadding - windowRect.width);
267-
} else if (anchorRect.x < this._edgePadding) {
270+
left = anchorRect.left - (anchorRect.left + flyoutRect.width + this._edgePadding - windowRect.width);
271+
} else if (anchorRect.left < this._edgePadding) {
268272
// it will render off screen to the left, move to the right
269273
left = this._edgePadding;
270274
} else {
271-
left = anchorRect.x;
275+
left = anchorRect.left;
272276
}
273277

274278
if (flyoutRect.height + 2 * this._edgePadding > windowRect.height) {
@@ -279,20 +283,20 @@ export class MgtFlyout extends LitElement {
279283
top = (windowRect.height - flyoutRect.height) / 2;
280284
}
281285
} else if (
282-
anchorRect.y + anchorRect.height + flyoutRect.height + this._edgePadding > windowRect.height &&
283-
anchorRect.y - flyoutRect.height - this._edgePadding > 0
286+
anchorRect.top + anchorRect.height + flyoutRect.height + this._edgePadding > windowRect.height &&
287+
anchorRect.top - flyoutRect.height - this._edgePadding > 0
284288
) {
285-
if (windowRect.height - anchorRect.y + flyoutRect.height < 0) {
289+
if (windowRect.height - anchorRect.top + flyoutRect.height < 0) {
286290
bottom = windowRect.height - flyoutRect.height - this._edgePadding;
287291
} else {
288-
bottom = Math.max(windowRect.height - anchorRect.y, this._edgePadding);
292+
bottom = Math.max(windowRect.height - anchorRect.top, this._edgePadding);
289293
}
290294
} else {
291-
if (anchorRect.y + anchorRect.height + flyoutRect.height + this._edgePadding > windowRect.height) {
295+
if (anchorRect.top + anchorRect.height + flyoutRect.height + this._edgePadding > windowRect.height) {
292296
// it will render offscreen bellow, move it up a bit
293297
top = windowRect.height - flyoutRect.height - this._edgePadding;
294298
} else {
295-
top = Math.max(anchorRect.y + anchorRect.height, this._edgePadding);
299+
top = Math.max(anchorRect.top + anchorRect.height, this._edgePadding);
296300
}
297301
}
298302

src/graph/graph.user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ export async function getUsersForUserIds(graph: IGraph, userIds: string[]): Prom
9898
}
9999

100100
return people;
101-
} catch {
101+
} catch (_) {
102102
// fallback to making the request one by one
103103
try {
104104
return Promise.all(userIds.filter(id => id && id !== '').map(id => getUser(graph, id)));
105-
} catch {
105+
} catch (_) {
106106
return [];
107107
}
108108
}

0 commit comments

Comments
 (0)