Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H5 Gridstack.js completely useless in safari #1540

Closed
kevinlandsberg opened this issue Dec 20, 2020 · 14 comments · Fixed by #1549
Closed

H5 Gridstack.js completely useless in safari #1540

kevinlandsberg opened this issue Dec 20, 2020 · 14 comments · Fixed by #1549

Comments

@kevinlandsberg
Copy link

kevinlandsberg commented Dec 20, 2020

Subject of the issue

Gridstack.js completely useless in safari.

Your environment

  • Gridstack.js version: 3.1.2 with HTML5
  • Safari, Version 14.0.2 (16610.3.7.1.9) under MacOS Big Sur

Steps to reproduce

Just visit libary homepage and try to use examples.

Expected behavior

Tiles should be draggable

Actual behavior

No dragging ability...

@adumesny
Copy link
Member

will take me a while to try this on a mac as I'm on windows...

@adumesny adumesny changed the title Gridstack.js completely useless in safari H5 Gridstack.js completely useless in safari Dec 20, 2020
@kevinlandsberg
Copy link
Author

Yeah,

but it seems to get more importance to support Safari cause Apple is selling a lot of computers atm 👍🏿

@kevinlandsberg
Copy link
Author

You can try out Browserstack (https://www.browserstack.com/)

@shmolf
Copy link

shmolf commented Dec 21, 2020

JavaScript Console Error

TypeError: $('.newWidget').draggable is not a function. (In '$('.newWidget').draggable({
      revert: 'invalid',
      scroll: false,
      appendTo: 'body',
      helper: 'clone'
    })', '$('.newWidget').draggable' is undefined)
    ```

@adumesny
Copy link
Member

@shmolf sounds like you are mixing html5 and jquery-ui there... I don't think that pertains to the site demos but I have not looked on safari yet.

@shmolf
Copy link

shmolf commented Dec 21, 2020

@shmolf sounds like you are mixing html5 and jquery-ui there... I don't think that pertains to the site demos but I have not looked on safari yet.

Ack! You're probably right. I'll try changing my assets, and let you know the result.

@shmolf
Copy link

shmolf commented Dec 21, 2020

I was using the following CDN URL
https://cdn.jsdelivr.net/npm/gridstack@3.1.2/dist/gridstack-h5.js

This was referenced by the JS Fiddle example.

Nothing else is loaded, other than CSS.

@shmolf
Copy link

shmolf commented Dec 21, 2020

We may independently use Jquery UI, but not for Gridstack.

Does Gridstack check if Jquery UI is globally available, then references if so?

@adumesny
Copy link
Member

please file a separate bug with reproduceable example. And no we don't reference JQ ui if it's available...onlyif our JQ plugin is used.

@shshen
Copy link

shshen commented Dec 27, 2020

I have same issue in safari, when i drag a grid element. I'm using latest release build:

[Error] ReferenceError: Can't find variable: DragEvent
initEvent (gridstack-h5.js:2:58075)
_dragStart (gridstack-h5.js:2:41983)
_dragStart

@adumesny
Copy link
Member

adumesny commented Dec 28, 2020

for now you will need to use the jquery version

adumesny added a commit to adumesny/gridstack.js that referenced this issue Dec 29, 2020
* partial fix for gridstack#1540
* DragEvent is not defined on Safari (regular MouseEvent + dataTransfer field)
* fixed initEvent() to clone the original event instead
which simplifies and gets rid of runtime error msg

more todo: dragstart now called, but not dragging. resizing works.
@adumesny adumesny pinned this issue Dec 31, 2020
@adumesny
Copy link
Member

adumesny commented Jan 1, 2021

I spent a lot of time over the break and think I have a fix for Safari (and also better behavior for Chrome). Help or Donations would be appreciated..

@kevinlandsberg
Copy link
Author

kevinlandsberg commented Jan 2, 2021

I spent a lot of time over the break and think I have a fix for Safari (and also better behavior for Chrome). Help or Donations would be appreciated..

I will definetly donate as soon as it will work on Safari and there will be the engine fix for swapping grid items instead of pushing them down...#149

adumesny added a commit to adumesny/gridstack.js that referenced this issue Jan 2, 2021
* fix gridstack#1540
* according to spec (and required by Safari) the drag image has to be visible in the browser (in dom and not hidden) so make it a 1px div
adumesny added a commit to adumesny/gridstack.js that referenced this issue Jan 2, 2021
* fix gridstack#1540
* DragEvent is not defined on Safari (regular MouseEvent + dataTransfer field)
so fixed initEvent() to not use `instanceof DragEvent` but copy fields
* according to spec (and required by Safari) the drag image has to be visible in
the browser (in dom and not hidden) so make it a 1px div
(this also helps chrome not showing a no-drop target cursor on Mac)
* more DD code cleanup
adumesny added a commit to adumesny/gridstack.js that referenced this issue Jan 2, 2021
* fix gridstack#1540
* DragEvent is not defined on Safari (regular MouseEvent + dataTransfer field)
so fixed initEvent() to not use `instanceof DragEvent` but copy fields
* according to spec (and required by Safari) the drag image has to be visible in
the browser (in dom and not hidden) so make it a 1px div
(this also helps chrome not showing a no-drop target cursor on Mac)
* more DD code cleanup
@adumesny adumesny mentioned this issue Jan 2, 2021
3 tasks
@adumesny
Copy link
Member

adumesny commented Jan 2, 2021

fixed in upcoming 3.1.3

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

Successfully merging a pull request may close this issue.

4 participants