Skip to content

Commit

Permalink
fix: voice over for person in list (#2206)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gavinbarron authored Apr 24, 2023
1 parent 721dbe4 commit c60567d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { Contact, Presence } from '@microsoft/microsoft-graph-types';
import { customElement, html, internalProperty, property, TemplateResult } from 'lit-element';
import { classMap } from 'lit-html/directives/class-map';
import { ifDefined } from 'lit-html/directives/if-defined';
import { findPeople, getEmailFromGraphEntity } from '../../graph/graph.people';
import { getGroupImage, getPersonImage } from '../../graph/graph.photos';
import { getUserPresence } from '../../graph/graph.presence';
Expand Down Expand Up @@ -586,7 +587,10 @@ export class MgtPerson extends MgtTemplatedComponent {
};

personTemplate = html`
<div class=${classMap(rootClasses)} tabindex="0">
<div
class=${classMap(rootClasses)}
tabindex=${ifDefined(this.personCardInteraction === PersonCardInteraction.click ? '0' : undefined)}
>
${imageWithPresenceTemplate} ${detailsTemplate}
</div>
`;
Expand Down
22 changes: 22 additions & 0 deletions stories/components/person/person.properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,26 @@ export const moreExamples = () => html`
line2-property="officeLocation"
></mgt-person>
</div>
<div>
<div>Lists of people</div>
<ul role="menu">
<li role="menuitem" data-is-focusable="true" class="ui-list__item" tabindex="0">
<mgt-person
person-query="me"
view="twoLines"
line2-property="jobTitle"
></mgt-person>
</li>
<li role="menuitem" data-is-focusable="true" class="ui-list__item" tabindex="-1">
<mgt-person
user-id="2804bc07-1e1f-4938-9085-ce6d756a32d2"
view="twoLines"
line2-property="jobTitle"
></mgt-person>
</li>
</ul>
</div>
`;

0 comments on commit c60567d

Please sign in to comment.