Skip to content

Commit c60567d

Browse files
authored
fix: voice over for person in list (#2206)
Conditionally removes tabindex attribute allowing voice over to see inside the html for mgt-person when nested inside an html element with the role menuitem
1 parent 721dbe4 commit c60567d

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

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
`;

stories/components/person/person.properties.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,4 +364,26 @@ export const moreExamples = () => html`
364364
line2-property="officeLocation"
365365
></mgt-person>
366366
</div>
367+
368+
369+
<div>
370+
<div>Lists of people</div>
371+
<ul role="menu">
372+
<li role="menuitem" data-is-focusable="true" class="ui-list__item" tabindex="0">
373+
<mgt-person
374+
person-query="me"
375+
view="twoLines"
376+
line2-property="jobTitle"
377+
></mgt-person>
378+
</li>
379+
<li role="menuitem" data-is-focusable="true" class="ui-list__item" tabindex="-1">
380+
<mgt-person
381+
user-id="2804bc07-1e1f-4938-9085-ce6d756a32d2"
382+
view="twoLines"
383+
line2-property="jobTitle"
384+
></mgt-person>
385+
</li>
386+
</ul>
387+
</div>
388+
367389
`;

0 commit comments

Comments
 (0)