polaris icon indicating copy to clipboard operation
polaris copied to clipboard

DatePicker appearing in the worng location on long pages

Open cargix1 opened this issue 9 years ago • 6 comments

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?

screen shot 2017-07-19 at 21 17 42 screen shot 2017-07-19 at 21 17 16

Steps to Reproduce the Problem

  1. 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>
  1. 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 avatar Jul 19 '17 20:07 cargix1

@cargix1 thanks for the issue. I was able to reproduce, and we'll get a fix in for this ASAP.

lemonmade avatar Jul 20 '17 16:07 lemonmade

Hi,

I have a somewhat similar issue with Tooltip:

capture d ecran 2017-07-21 a 22 09 44

(The triggered element is the "Order #1001" link in the SMS history list)

bakura10 avatar Jul 21 '17 20:07 bakura10

I'm having this same issue. Any updates?

cgenevier avatar Aug 03 '17 18:08 cgenevier

@cargix1 can you confirm if this is still happening in the latest version of Polaris?

dfmcphee avatar Nov 21 '17 15:11 dfmcphee

Hey @dfmcphee it seems to be working great this end now thanks :)

cargix1 avatar Nov 21 '17 17:11 cargix1

Great, thanks!

dfmcphee avatar Nov 21 '17 18:11 dfmcphee