blackberry / bbUI.js

BlackBerry UI look and feel JavaScript toolkit for WebWorks
Apache License 2.0
312 stars 192 forks source link

Conflict with bbui.js, webkitRequestFileSystem, com.blackberry.app, com.blackerry.io, menu and overflow on action bar #1012

Closed miamon closed 10 years ago

miamon commented 10 years ago

Seems exist a conflict between bbui.js and WebWorks SDK 2.0 Gold when you use webkitRequestFileSystem on a data-bb-type="menu" or data-bb-type="action" data-bb-style="button" data-bb-overflow="true"

work fine on data-bb-type="button" and data-bb-type="action" data-bb-style="button"

Just commented here: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Webworks-2-0-gold-and-webkitRequestFileSystem-for-write-a-file/td-p/2843986

and a complete example of this issue here: https://github.com/miamon/BB10-WebWorks-Samples/tree/master/BfB-Boilerplate-bbUI.js-0.9x

I had this modification: https://github.com/miamon/BB10-WebWorks-Samples/compare/blackberry:master...master

tneil commented 10 years ago

Hi @miamon, I'm not sure I understand which ones work and which ones don't.. It seems that you have listed that data-bb-type="button" and data-bb-type="action" data-bb-style="button" both do not work and do work??

tneil commented 10 years ago

Are you saying that if you use a bbUI menu or an action button that is in an overflow that the problem occurs?

tneil commented 10 years ago

Looking at your code... is the call to window.webkitRequestFileSystem failing?

For instance, what happens when you do the following:

window.webkitRequestFileSystem(window.PERSISTENT, 1024 * 1024, onInitFsWriteBackup, errorHandler);
alert('I am here');

Does the "I am here" get run?

miamon commented 10 years ago

Hi Tim, yes are failing on:

But works fine on:

miamon commented 10 years ago

Yes, alert('I am here') run fine.

I tested too with console.log('I am here'); and works fine too.

tneil commented 10 years ago

So if I understand your description, neither onInitFsWriteBackup nor errorHandler is being called?

miamon commented 10 years ago

Yes, onInitFsWriteBackup is not fired and not appears an error on errorHandler

bryanhiggins commented 10 years ago

I was able to reproduce this when calling webkitRequestFileSystem from the overflow menu. There may be a webkit bug here.

Wrapping the call in requestAnimationFrame is a work around.

miamon commented 10 years ago

Now works fine. Thanks Tim and Bryan!!

tneil commented 10 years ago

Wow.. really strange... all that happens with the DIV in the overflow is that it is re-parented to a new DIV (the overflow area). The onclick isn't touched in code.

The only other common thing I can think of is that an additional "click" event listener is added to start the animation/transition to hide the menu. Maybe there's some weird animation/event combination issue in webkit that requestAnimationFrame fixes.