diff --git a/packages/mgt-components/src/components/mgt-person/mgt-person.ts b/packages/mgt-components/src/components/mgt-person/mgt-person.ts index c00448010d..51495a2a61 100644 --- a/packages/mgt-components/src/components/mgt-person/mgt-person.ts +++ b/packages/mgt-components/src/components/mgt-person/mgt-person.ts @@ -939,15 +939,17 @@ export class MgtPerson extends MgtTemplatedTaskComponent { // Render the line1 template const template = this.renderTemplate('line1', { person }); details.push(html` -
- this.handleLine1Clicked()} role="presentation" aria-label="${line1text}">${template}
+
this.handleLine1Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine1Clicked()} + role="presentation" aria-label="${line1text}">${template}
`); } else { // Render the line1 property value if (line1text) { details.push(html` -
- this.handleLine1Clicked()} role="presentation" aria-label="${line1text}">${line1text}
+
this.handleLine1Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine1Clicked()} + role="presentation" aria-label="${line1text}">${line1text}
`); } } @@ -959,15 +961,17 @@ export class MgtPerson extends MgtTemplatedTaskComponent { // Render the line2 template const template = this.renderTemplate('line2', { person }); details.push(html` -
- this.handleLine2Clicked()} role="presentation" aria-label="${text}">${template}
+
this.handleLine2Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine2Clicked()} + role="presentation" aria-label="${text}">${template}
`); } else { // Render the line2 property value if (text) { details.push(html` -
- this.handleLine2Clicked()} role="presentation" aria-label="${text}">${text}
+
this.handleLine2Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine2Clicked()} + role="presentation" aria-label="${text}">${text}
`); } } @@ -980,15 +984,17 @@ export class MgtPerson extends MgtTemplatedTaskComponent { // Render the line3 template const template = this.renderTemplate('line3', { person }); details.push(html` -
- this.handleLine3Clicked()} role="presentation" aria-label="${text}">${template}
+
this.handleLine3Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine3Clicked()} + role="presentation" aria-label="${text}">${template}
`); } else { // Render the line3 property value if (text) { details.push(html` -
- this.handleLine3Clicked()} role="presentation" aria-label="${text}">${text}
+
this.handleLine3Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine3Clicked()} + role="presentation" aria-label="${text}">${text}
`); } } @@ -1001,15 +1007,17 @@ export class MgtPerson extends MgtTemplatedTaskComponent { // Render the line4 template const template = this.renderTemplate('line4', { person }); details.push(html` -
- this.handleLine4Clicked()} role="presentation" aria-label="${text}">${template}
+
this.handleLine4Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine4Clicked()} + role="presentation" aria-label="${text}">${template}
`); } else { // Render the line4 property value if (text) { details.push(html` -
- this.handleLine4Clicked()} role="presentation" aria-label="${text}">${text}
+
this.handleLine4Clicked()} + @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.handleLine4Clicked()} + role="presentation" aria-label="${text}">${text}
`); } } diff --git a/stories/components/person/person.html.stories.js b/stories/components/person/person.html.stories.js index 67b9392a71..bf1e4fd5ae 100644 --- a/stories/components/person/person.html.stories.js +++ b/stories/components/person/person.html.stories.js @@ -27,11 +27,32 @@ export const person = () => html` `; export const events = () => html` +
Click on each line
- + + + + + +
-
no line clicked