DatePicker appearing in the worng location on long pages
Issue summary
When having to scroll to activate a DatePicker component it appears in the wrong place.
Expected behavior
I'd expect the DatePicker to appear just above/below the field that was clicked to activate it.
Actual behavior
When I click to activate the DatePicker component the browser shoots upwards causing the DatePicker to display in the wrong location. I'm thinking a simple call to e.preventDefault() would solve this, but it doesn't appear that we are getting the click event passed through the component. I'm wondering if this is similar to what @bakura10 described in https://github.com/Shopify/polaris/issues/135?
Steps to Reproduce the Problem
- Within an AnnotatedSection create a sectioned Card and push the DatePicker component down the page so you have to scroll to see it. In this example I created an empty DIV with a height of 1000px to simulate this.
<Layout.AnnotatedSection title="Store Pickup">
<Card sectioned>
<div style={{height: "1000px"}}></div>
<p>Prevent customers from selecting pickups from this outlet on specific dates of the year.</p><br/>
<div data-polaris-layer style={{position: 'relative', zIndex: 1}}>
<Popover
preferredPosition="below"
activator={
<TextField
type="text"
label="Date"
connectedRight={<Button icon="add">Add blackout date</Button>}
/>
}
>
<DatePicker
month={5}
year={2017}
/>
</Popover>
</div>
</Card>
</Layout.AnnotatedSection>
- Scroll down the page, activate the DatePicker and notice how the page jumps to the top and the DatePicker appears in the wrong place.
Specifications
- Polaris version: 1.1.1
- React version: 15.6.1
- Browser: Chrome
- Device: Macbook Pro
- Operating System: Sierra
NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.
@cargix1 thanks for the issue. I was able to reproduce, and we'll get a fix in for this ASAP.
Hi,
I have a somewhat similar issue with Tooltip:
(The triggered element is the "Order #1001" link in the SMS history list)
I'm having this same issue. Any updates?
@cargix1 can you confirm if this is still happening in the latest version of Polaris?
Hey @dfmcphee it seems to be working great this end now thanks :)
Great, thanks!