You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
<!--
☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
- Start with a verb, for example: Add, Delete, Improve, Fix…
- Give as much context as necessary and as little as possible
- Prefix it with [WIP] while it’s a work in progress
-->
### WHY are these changes introduced?
Closeshttps://github.com/Shopify/core-workflows/issues/663
This PR fixes a bug with `Tooltip` and other consumers of
`PositionedOverlay` where the position of the overlay does not correctly
update when the overlay's closest `Scrollable` ancestor is **_not_**
being scrolled, but some more distant ancestor node **_is_** being
scrolled. In such cases, the overlay position moves with the more
distant ancestor node rather than the correct `Scrollable` node.
(The bug specifically occurs `Tooltip` instances rendered in a
`Scrollable`, because the `PositionedOverlay` from the tooltip is
rendered in a `PortalContainer`, which is a descendant of the `body`
rather than the tooltip's `Scrollable`.)
### WHAT is this pull request doing?
<!--
Summary of the changes committed.
Before / after screenshots are appreciated for UI changes. Make sure to
include alt text that describes the screenshot.
If you include an animated gif showing your change, wrapping it in a
details tag is recommended. Gifs usually autoplay, which can cause
accessibility issues for people reviewing your PR:
<details>
<summary>Summary of your gif(s)</summary>
<img src="..." alt="Description of what the gif shows">
</details>
-->
This PR ensures that `scroll` event handlers are added to all scrollable
ancestors of the component, rather than just the nearest scrollable
ancestor. This fixes a bug where the tooltip "sticks" to the page body
rather than the correct scrollable container.
This video shows the correct behaviour:
https://user-images.githubusercontent.com/1948799/210642458-ec0f7a77-9021-46c9-8283-8e7665a05ade.mov
### How to 🎩
Tophatting URL:
https://admin.web.tooltip-polaris.jerad-gallinger.us.spin.dev/store/shop1
- Open the admin
- Resize your browser window to be tall enough for the left nav to not
scroll
- In the left-hand nav, hover over `Online Store`. The tooltip should
appear as usual.
- While still hovering over the nav item, scroll the page (with up/down
arrow keys, trackpad gestures, or scroll wheel). When the main page
content scrolls, the tooltip should reposition so that it still appears
above the nav item (rather than scrolling with the main page content).
- Resize the height of the browser so that the left nav content
overflows the height of the nav and becomes scrollable.
- Scroll the left nav to the bottom of its contents. Hover over the
`Online Store` item so the tooltip appears.
- While still hovering over the nav item, scroll the page down (with
up/down arrow keys, trackpad gestures, or scroll wheel). When the main
page content scrolls, the tooltip should reposition so that it still
appears above the nav item (rather than scrolling with the main page
content).
### 🎩 checklist
- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [X] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
0 commit comments