Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Modal content not scrolling on iOS Safari #432

Open
collegetransitions opened this issue May 17, 2021 · 1 comment
Open

Modal content not scrolling on iOS Safari #432

collegetransitions opened this issue May 17, 2021 · 1 comment

Comments

@collegetransitions
Copy link

To Reproduce
Steps to reproduce the behavior:

  1. On an iPhone, go to https://vue.chakra-ui.com/modal#modal-overflow-behavior
  2. Click on "Open Modal" button
  3. Attempt to scroll content using 1 finger
  4. Content does not scroll

Expected behavior
Content should scroll when using one finger, with momentum.

Smartphone

  • Device: iPhone (any)
  • OS: Tested on iOS 14
  • Browser: Mobile Safari

Additional context
Modal focus locking & scrolling seem to be handled by v-scroll-lock, a Vue wrapper around body-scroll-lock, which has an issue that may be the cause of this bug: willmcpo/body-scroll-lock#207

@collegetransitions
Copy link
Author

Update: I got past this issue by following an [example from body-scroll-lock](https://github.com/willmcpo/body-scroll-lock#options to look for a body-scroll-lock-ignore attribute and allow touch events within that element.

Vue.use(VScrollLock, {
  enableBodyScroll,
  disableBodyScroll,
  bodyScrollOptions: {
    allowTouchMove: el => {
      while (el && el !== document.body) {
        if (el.getAttribute('body-scroll-lock-ignore') !== null) {
          return true;
        }
  
        el = el.parentElement;
      }
    },
  },
})

and then adding 'body-scroll-lock-ignore': true, to the ModalContent attrs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant