fix: Tooltip should not hide if an element inside it gets focused#25140
fix: Tooltip should not hide if an element inside it gets focused#25140khmakoto merged 4 commits intomicrosoft:masterfrom
Conversation
📊 Bundle size report🤖 This report was generated against 223571d0a6317630a2c376d278c3e4a60c10e97a |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 4178286:
|
Asset size changes
Baseline commit: 223571d0a6317630a2c376d278c3e4a60c10e97a (build) |
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| BaseButton | mount | 1175 | 1211 | 5000 | |
| Breadcrumb | mount | 2985 | 3018 | 1000 | |
| Checkbox | mount | 2711 | 2702 | 5000 | |
| CheckboxBase | mount | 2288 | 2375 | 5000 | |
| ChoiceGroup | mount | 4400 | 4347 | 5000 | |
| ComboBox | mount | 1262 | 1289 | 1000 | |
| CommandBar | mount | 9582 | 9528 | 1000 | |
| ContextualMenu | mount | 11440 | 11022 | 1000 | |
| DefaultButton | mount | 1387 | 1421 | 5000 | |
| DetailsRow | mount | 3617 | 3605 | 5000 | |
| DetailsRowFast | mount | 3692 | 3647 | 5000 | |
| DetailsRowNoStyles | mount | 3491 | 3476 | 5000 | |
| Dialog | mount | 3087 | 3118 | 1000 | |
| DocumentCardTitle | mount | 580 | 591 | 1000 | |
| Dropdown | mount | 3255 | 3237 | 5000 | |
| FocusTrapZone | mount | 2025 | 2054 | 5000 | |
| FocusZone | mount | 2011 | 1992 | 5000 | |
| GroupedList | mount | 53879 | 61029 | 2 | |
| GroupedList | virtual-rerender | 25187 | 25106 | 2 | |
| GroupedList | virtual-rerender-with-unmount | 94380 | 95264 | 2 | |
| GroupedListV2 | mount | 575 | 572 | 2 | |
| GroupedListV2 | virtual-rerender | 547 | 536 | 2 | |
| GroupedListV2 | virtual-rerender-with-unmount | 562 | 575 | 2 | |
| IconButton | mount | 1862 | 2013 | 5000 | |
| Label | mount | 727 | 754 | 5000 | |
| Layer | mount | 4324 | 4275 | 5000 | |
| Link | mount | 837 | 841 | 5000 | |
| MenuButton | mount | 1682 | 1695 | 5000 | |
| MessageBar | mount | 2276 | 2279 | 5000 | |
| Nav | mount | 3293 | 3223 | 1000 | |
| OverflowSet | mount | 1372 | 1354 | 5000 | |
| Panel | mount | 2585 | 2603 | 1000 | |
| Persona | mount | 1263 | 1292 | 1000 | |
| Pivot | mount | 1653 | 1679 | 1000 | |
| PrimaryButton | mount | 1518 | 1524 | 5000 | |
| Rating | mount | 6927 | 6961 | 5000 | |
| SearchBox | mount | 1528 | 1534 | 5000 | |
| Shimmer | mount | 2889 | 2877 | 5000 | |
| Slider | mount | 2150 | 2101 | 5000 | |
| SpinButton | mount | 4719 | 4688 | 5000 | |
| Spinner | mount | 796 | 835 | 5000 | |
| SplitButton | mount | 3115 | 3135 | 5000 | |
| Stack | mount | 853 | 840 | 5000 | |
| StackWithIntrinsicChildren | mount | 2315 | 2365 | 5000 | |
| StackWithTextChildren | mount | 4731 | 4761 | 5000 | |
| SwatchColorPicker | mount | 10642 | 10539 | 5000 | |
| TagPicker | mount | 2759 | 2697 | 5000 | |
| TeachingBubble | mount | 90470 | 89833 | 5000 | |
| Text | mount | 803 | 786 | 5000 | |
| TextField | mount | 1539 | 1623 | 5000 | |
| ThemeProvider | mount | 1508 | 1512 | 5000 | |
| ThemeProvider | virtual-rerender | 1073 | 1093 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 2146 | 2140 | 5000 | |
| Toggle | mount | 1107 | 1142 | 5000 | |
| buttonNative | mount | 545 | 554 | 5000 |
| directionalHintForRTL={directionalHintForRTL} | ||
| calloutProps={assign({}, calloutProps, { | ||
| onDismiss: this._hideTooltip, | ||
| onFocus: this._onTooltipContentFocus, |
There was a problem hiding this comment.
Do you also need onBlur to dismiss the tooltip when it loses focus (e.g. tabbing out of the tooltip after clicking the link)? Or is that handled by the callout already?
There was a problem hiding this comment.
Yeah, that's handled by Callout already.
* master: (23 commits) Revert "chore: screener-run workflow should report to PR (microsoft#25144)" (microsoft#25145) chore: screener-run workflow should report to PR (microsoft#25144) applying package updates fix: The Tooltip should not hide if it gets keyboard focus (microsoft#25138) fix: Tooltip should not hide if an element inside it gets focused (microsoft#25140) Create react-migration-v8-v9 with shims and stories (microsoft#25121) fix: CheckboxField to set a generated ID on the input, to match the label's htmlFor (microsoft#25079) feat: Overflow menu should be registered in overflowManager (microsoft#25091) fix: version-bump generator removes beachball disallowedChangeType config (microsoft#25130) fix: new overflow items should only be enqueued while observing (microsoft#25122) fix(script): allow runPublished call from CLI (microsoft#25127) feat: add vertical variation for toolbar (microsoft#24940) ProgressField implementation and stories (microsoft#25103) fix: Dropdown icon layout with no placeholder/value (microsoft#25049) chore: add a bundle size fixture (Button, Provider & theme) (microsoft#25113) feat: Adding subtle transition between states on Button components (microsoft#25106) Revert "chore: screener-run workflow should report to PR (microsoft#25096)" (microsoft#25115) chore: screener-run workflow should report to PR (microsoft#25096) fix(react-dialog): aria-* properties should be reassignable (microsoft#25092) fix(scripts): don't run publish if web-components are affected (microsoft#25095) ...
…crosoft#25140) * fix: Tooltip should not hide if an element inside it gets focused. * Adding change fil. * Changing delay on blur from 1ms to 0ms. * Removing changes in Tooltip example. Co-authored-by: Humberto Makoto Morimoto Burgos <makotom@microsoft.com>
Previous Behavior
If a
Tooltipis triggered by focusing on the element withinTooltipHost, and theTooltipcontains any interactable items, then trying to interact with these items within theTooltip(for example, clicking on a link within it) will cause theTooltipto close. This occurs because theTooltipcloses immediately onblur, which precedes other interactions likefocusorclick.New Behavior
A 0ms timeout has been added before the
Tooltipcloses on blur, and a check has been added so that if anything within theTooltipgets focus then the timeout is cleared. Because of the way that events queue on the browser, this ensures that we can always interact with content within theTooltipbefore it closes onblur.Related Issue(s)
Fixes #24054
Fixes #25001
PR #25138 fixes the same issue in v9+