-
Notifications
You must be signed in to change notification settings - Fork 2.9k
TooltipHost: Include aria-described #1628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
e511175
519c9cf
6b7aed3
37f629e
c47d01d
d8f4079
21c2c0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "office-ui-fabric-react", | ||
| "comment": "Add aria-describedby to tooltiphost component", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "email": "ottost@microsoft.com" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ import { TooltipDelay } from './Tooltip.Props'; | |
|
|
||
| import * as stylesImport from './TooltipHost.scss'; | ||
| const styles: any = stylesImport; | ||
| import { getId } from '@uifabric/utilities'; | ||
|
|
||
| export interface ITooltipHostState { | ||
| isTooltipVisible?: boolean; | ||
|
|
@@ -42,7 +43,7 @@ export class TooltipHost extends BaseComponent<ITooltipHostProps, ITooltipHostSt | |
| public render() { | ||
| const { calloutProps, content, children, directionalHint, delay } = this.props; | ||
| const { isTooltipVisible } = this.state; | ||
|
|
||
| const tooltipId = getId('tooltip'); | ||
| return ( | ||
| <div | ||
| className={ css('ms-TooltipHost', styles.host) } | ||
|
|
@@ -51,10 +52,12 @@ export class TooltipHost extends BaseComponent<ITooltipHostProps, ITooltipHostSt | |
| { ...{ onBlurCapture: this._onTooltipMouseLeave } } | ||
| onMouseEnter={ this._onTooltipMouseEnter } | ||
| onMouseLeave={ this._onTooltipMouseLeave } | ||
| aria-describedby={ isTooltipVisible ? tooltipId : "" } | ||
| > | ||
| { children } | ||
| { isTooltipVisible && ( | ||
| <Tooltip | ||
| id={ tooltipId } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't work
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ostreifel the tooltip is lying to us :) these props are never applied, unfortunately
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| delay={ delay } | ||
| content={ content } | ||
| targetElement={ this._getTargetElement() } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the user might have provided an
idin props.. we should use that.. soconst { ......, id } = this.props;const tooltipId = id || getId('tooltip';