-
Notifications
You must be signed in to change notification settings - Fork 108
fix(many): fix Tooltip focus issues and make Tooltip closeable inside of a Modal #1889
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 all commits
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 |
|---|---|---|
|
|
@@ -132,7 +132,11 @@ const propTypes: PropValidators<PropKeys> = { | |
| /** | ||
| * provides a reference to the underlying html root element | ||
| */ | ||
| elementRef: PropTypes.func | ||
| elementRef: PropTypes.func, | ||
| /** | ||
| * Whether or not the element is a Tooltip | ||
| */ | ||
| isTooltip: PropTypes.bool | ||
|
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. is this needed for something?
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. it is needed because of the |
||
| } | ||
|
|
||
| const allowedProps: AllowedPropKeys = [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,7 +159,7 @@ class Tooltip extends Component<TooltipProps, TooltipState> { | |
| defaultIsShowingContent={defaultIsShowingContent} | ||
| on={on} | ||
| shouldRenderOffscreen | ||
| shouldReturnFocus={true} | ||
| shouldReturnFocus={false} | ||
|
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. this line which caused the whole issue is reverted to false |
||
| placement={placement} | ||
| color={color === 'primary' ? 'primary-inverse' : 'primary'} | ||
| mountNode={mountNode} | ||
|
|
||
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.
This solution is based on registering the Tooltips ESC event listener first, even before the Modal's, so when pressing ESC, the first registered event listener (the one belonging to the Tooltip) is executed first as well. Then the event propagation is stoped from reaching the Modal.