Skip to content

Commit 52b118c

Browse files
authored
Merge pull request #2220 from microsoftgraph/main
release v2.10.1
2 parents b7ca94c + 8482959 commit 52b118c

File tree

12 files changed

+164
-84
lines changed

12 files changed

+164
-84
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "root",
33
"private": true,
4-
"version": "2.10.0",
4+
"version": "2.10.1",
55
"workspaces": [
66
"packages/*",
77
"packages/providers/*",

packages/mgt-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"build": "npm-run-all clean build:compile",
2828
"build:compile": "npm-run-all sass compile",
2929
"build:watch": "npm-run-all -p sass:watch compile:watch",
30-
"clean": "shx rm -rf ./dist && shx rm -rf ./tsconfig.tsbuildinfo",
30+
"clean": "shx rm -rf ./dist && shx rm -rf ./tsconfig.tsbuildinfo && shx rm 'src/**/*-css.ts' || shx true",
3131
"compile": "tsc -b",
3232
"compile:watch": "tsc -w",
3333
"lint": "tslint -c ../../tslint.json 'src/**/*.ts'",

packages/mgt-components/src/components/mgt-people-picker/mgt-people-picker.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ mgt-people-picker .root {
126126
color: $dropdown-item__text__color--hover;
127127
}
128128
}
129-
&.focused {
129+
130+
&:focus,
131+
&:focus-within {
130132
background-color: $dropdown-item__background-color--hover;
131133
.people-person-text-area {
132134
color: $dropdown-item__text__color--hover;

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

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
572572
private defaultPeople: IDynamicPerson[];
573573

574574
// tracking of user arrow key input for selection
575-
private _arrowSelectionCount: number = -1;
575+
@state() private _arrowSelectionCount = -1;
576+
576577
// List of people requested if group property is provided
577578
private _groupPeople: IDynamicPerson[];
578579
private _debouncedSearch: { (): void; (): void };
@@ -852,13 +853,18 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
852853
*/
853854
protected renderFlyout(anchor: TemplateResult): TemplateResult {
854855
return html`
855-
<mgt-flyout light-dismiss class="flyout">
856-
${anchor}
857-
<div slot="flyout" class="flyout-root" @wheel=${(e: WheelEvent) => this.handleSectionScroll(e)}>
858-
${this.renderFlyoutContent()}
859-
</div>
860-
</mgt-flyout>
861-
`;
856+
<mgt-flyout light-dismiss class="flyout">
857+
${anchor}
858+
<div
859+
slot="flyout"
860+
class="flyout-root"
861+
@wheel=${(e: WheelEvent) => this.handleSectionScroll(e)}
862+
@keydown=${(e: KeyboardEvent) => this.onUserKeyDown(e)}
863+
>
864+
${this.renderFlyoutContent()}
865+
</div>
866+
</mgt-flyout>
867+
`;
862868
}
863869

864870
/**
@@ -937,7 +943,6 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
937943
*/
938944
protected renderSearchResults(people: IDynamicPerson[]) {
939945
const filteredPeople = people.filter(person => person.id);
940-
941946
return html`
942947
<ul
943948
id="suggestions-list"
@@ -950,14 +955,16 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
950955
filteredPeople,
951956
person => person.id,
952957
person => {
958+
const lineTwo = person.jobTitle || (person as User).mail;
959+
const ariaLabel = `${this.strings.suggestedContact} ${person.displayName} ${lineTwo ?? ''}`;
953960
return html`
954961
<li
955962
id="${person.id}"
956-
aria-label=" ${this.strings.suggestedContact} ${person.displayName}"
963+
aria-label="${ariaLabel}"
957964
class="list-person"
958965
role="option"
959966
@click="${e => this.handleSuggestionClick(person)}">
960-
${this.renderPersonResult(person)}
967+
${this.renderPersonResult(person)}
961968
</li>
962969
`;
963970
}
@@ -1309,6 +1316,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
13091316
if (this.input) {
13101317
this.input.setAttribute('aria-expanded', 'true');
13111318
}
1319+
this._arrowSelectionCount = -1;
13121320
}
13131321

13141322
/**
@@ -1387,13 +1395,13 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
13871395
private gainedFocus() {
13881396
this.clearHighlighted();
13891397
this._isFocused = true;
1390-
this.loadState();
1398+
void this.loadState();
1399+
this.showFlyout();
13911400
}
13921401

13931402
// handle input blur
13941403
private lostFocus() {
13951404
this._isFocused = false;
1396-
this._arrowSelectionCount = -1;
13971405
if (this.input) {
13981406
this.input.setAttribute('aria-expanded', 'false');
13991407
this.input.setAttribute('aria-activedescendant', '');
@@ -1402,9 +1410,9 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
14021410
const peopleList = this.renderRoot.querySelector('.people-list');
14031411

14041412
if (peopleList) {
1405-
for (let i = 0; i < peopleList.children.length; i++) {
1406-
peopleList.children[i].classList.remove('focused');
1407-
peopleList.children[i].setAttribute('aria-selected', 'false');
1413+
for (const el of peopleList.children) {
1414+
el.classList.remove('focused');
1415+
el.setAttribute('aria-selected', 'false');
14081416
}
14091417
}
14101418

@@ -1626,9 +1634,8 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
16261634

16271635
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
16281636
this.handleArrowSelection(event);
1629-
if (input.value.length > 0) {
1630-
event.preventDefault();
1631-
}
1637+
// prevent page from scrolling
1638+
event.preventDefault();
16321639
}
16331640

16341641
if (event.code === 'Enter') {
@@ -1862,28 +1869,31 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
18621869
if (this._arrowSelectionCount === -1) {
18631870
this._arrowSelectionCount = 0;
18641871
} else {
1865-
this._arrowSelectionCount = (this._arrowSelectionCount + 1) % peopleList.children.length;
1872+
this._arrowSelectionCount =
1873+
(this._arrowSelectionCount + 1 + peopleList.children.length) % peopleList.children.length;
18661874
}
18671875
}
18681876
}
18691877

18701878
// reset background color
18711879
// reset aria-selected to false
1872-
// tslint:disable-next-line: prefer-for-of
1873-
for (let i = 0; i < peopleList.children.length; i++) {
1874-
peopleList.children[i].classList.remove('focused');
1875-
peopleList.children[i].setAttribute('aria-selected', 'false');
1880+
for (const person of peopleList?.children) {
1881+
const p = person as HTMLElement;
1882+
p.setAttribute('aria-selected', 'false');
1883+
p.removeAttribute('tabindex');
1884+
p.blur();
18761885
}
18771886

18781887
// set selected background
18791888
// set aria-selected to true
18801889
const focusedItem = peopleList.children[this._arrowSelectionCount] as HTMLElement;
18811890

18821891
if (focusedItem) {
1883-
focusedItem.classList.add('focused');
1892+
focusedItem.setAttribute('tabindex', '0');
1893+
focusedItem.focus();
18841894
focusedItem.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
18851895
focusedItem.setAttribute('aria-selected', 'true');
1886-
this.input.setAttribute('aria-activedescendant', peopleList.children[this._arrowSelectionCount].id);
1896+
this.input.setAttribute('aria-activedescendant', focusedItem.id);
18871897
}
18881898
}
18891899
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { Contact, Presence } from '@microsoft/microsoft-graph-types';
99
import { customElement, html, internalProperty, property, TemplateResult } from 'lit-element';
1010
import { classMap } from 'lit-html/directives/class-map';
11+
import { ifDefined } from 'lit-html/directives/if-defined';
1112
import { findPeople, getEmailFromGraphEntity } from '../../graph/graph.people';
1213
import { getGroupImage, getPersonImage } from '../../graph/graph.photos';
1314
import { getUserPresence } from '../../graph/graph.presence';
@@ -586,7 +587,10 @@ export class MgtPerson extends MgtTemplatedComponent {
586587
};
587588

588589
personTemplate = html`
589-
<div class=${classMap(rootClasses)} tabindex="0">
590+
<div
591+
class=${classMap(rootClasses)}
592+
tabindex=${ifDefined(this.personCardInteraction === PersonCardInteraction.click ? '0' : undefined)}
593+
>
590594
${imageWithPresenceTemplate} ${detailsTemplate}
591595
</div>
592596
`;

0 commit comments

Comments
 (0)