Make tooltips keyboard accessible (#7281)
* show tooltips on hover in eventtile Signed-off-by: Kerry Archibald <kerrya@element.io> * use tooltip props pass thru * use tooltiptarget in InfoTooltip Signed-off-by: Kerry Archibald <kerrya@element.io> * use target in TestWithTooltip Signed-off-by: Kerry Archibald <kerrya@element.io> * tsc fixes Signed-off-by: Kerry Archibald <kerrya@element.io> * test tooltip target Signed-off-by: Kerry Archibald <kerrya@element.io> * lint fix Signed-off-by: Kerry Archibald <kerrya@element.io> * rename tooltip handlers Signed-off-by: Kerry Archibald <kerrya@element.io> * update copyright to 2021 Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
4712ae49b2
commit
0c850b2f13
11 changed files with 242 additions and 98 deletions
|
@ -52,14 +52,14 @@ export default class AccessibleTooltipButton extends React.PureComponent<IToolti
|
|||
}
|
||||
}
|
||||
|
||||
onMouseOver = () => {
|
||||
showTooltip = () => {
|
||||
if (this.props.forceHide) return;
|
||||
this.setState({
|
||||
hover: true,
|
||||
});
|
||||
};
|
||||
|
||||
onMouseLeave = () => {
|
||||
hideTooltip = () => {
|
||||
this.setState({
|
||||
hover: false,
|
||||
});
|
||||
|
@ -78,8 +78,10 @@ export default class AccessibleTooltipButton extends React.PureComponent<IToolti
|
|||
return (
|
||||
<AccessibleButton
|
||||
{...props}
|
||||
onMouseOver={this.onMouseOver}
|
||||
onMouseLeave={this.onMouseLeave}
|
||||
onMouseOver={this.showTooltip}
|
||||
onMouseLeave={this.hideTooltip}
|
||||
onFocus={this.showTooltip}
|
||||
onBlur={this.hideTooltip}
|
||||
aria-label={title}
|
||||
>
|
||||
{ children }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue