Android icon indicating copy to clipboard operation
Android copied to clipboard

Webview positioned partially offscreen hides content

Open sanogueralorenzo opened this issue 3 years ago • 20 comments

Describe the bug Any drawing app scrolls up and down while drawing. Possibly related to https://github.com/duckduckgo/Android/pull/674 makes DDG completely unusable in this matter.

How to Reproduce Steps to reproduce the behavior:

  1. Go to https://sketch.io/sketchpad/
  2. Try to draw anything
  3. See error

Expected behavior Drawing should be able to work on any webpage with drawing canvas capabilities, coordinator layout should stop going up and down while you are drawing, making drawing impossible

Smartphone (please complete the following information):

  • DDG App Version: 5.62.0 zk (been there at least since I started using it half a year
  • Device: All phones
  • OS: All OS

sanogueralorenzo avatar Aug 21 '20 23:08 sanogueralorenzo

Thanks for reporting and sharing that website as an example. We knew about websites having bottom-anchored content being affected, but this one is a different and totally valid use case too.

Related: https://github.com/duckduckgo/Android/issues/638

cmonfortep avatar Aug 23 '20 08:08 cmonfortep

I'm new to contributing to opensource projects. Can I work on this issue?

kwawmannanjnr avatar Sep 01 '20 08:09 kwawmannanjnr

@kwawmannanjnr definitely, we welcome PRs for any issues tagged with help wanted. Check out our CONTRIBUTING.md guidelines for more information.

subsymbolic avatar Sep 01 '20 12:09 subsymbolic

Information for possible contributions: The issue is that the web view can actually off be positioned partially offscreen depending on the scrolling. When you scroll the page, the toolbar slides up, as does the web view. So only when the toolbar is fully up off screen is the web view fully positioned onscreen. It seems to be a combo of the scroll behaviour + CoordinatorLayout that is causing the issue.

Some websites where this issue is easy to reproduce are:

  • twitter.com -> Bottom bar is hidden and user needs to scroll to make it appear. Expectation is that bottom bar is visible always.
  • https://sketch.io/sketchpad/ -> as described in the description

cmonfortep avatar Sep 30 '20 09:09 cmonfortep

@cmonfortep if this issue is one that's "different and totally valid use case too" then why did you close #638 ? This issue looks complex and different the one described in that other issue. The complexity of trying to fix the sketchpad app vs bottom navbar / fixed position elements generally is a different issue imo.

garygreen avatar Oct 26 '20 15:10 garygreen

Hi @garygreen, by "this one is different" I didn't want to say it's another problem, but a new scenario that we didn't know about. Both issues are affected by the same root cause.

I understand your point here, however, we didn't want to keep both issues open and decided to give this one more visibility during Hacktoberfest. I apologize if that was not clear.

In any case, we also posted this comment, which explains the root cause, and also shares the examples we commented in https://github.com/duckduckgo/Android/issues/638

cmonfortep avatar Oct 26 '20 16:10 cmonfortep

Tracking this internally: https://app.asana.com/0/0/1187616573788673/f

cmonfortep avatar Jan 07 '21 16:01 cmonfortep

Are you guys fixing this internally or could I try to tackle this?

tvalle avatar Jan 11 '21 23:01 tvalle

Go for it! We are tracking this issue internally, but we haven't had time to work on that yet.

cmonfortep avatar Jan 12 '21 00:01 cmonfortep

Unfortunately I couldn't understand what's the cause of this issue so I couldn't provide a fix. I'll try another issue to fix.

But while experimenting and trying to understand what's going I saw this behaviour: if in fragment_browser_tab.xml one sets android:fitsSystemWindows="true" on the root CoordinatorLayout and then set android:layout_marginBottom="?attr/actionBarSize" in the ConstraintLayout with id browserLayout everything works properly (sketchpad and Twitter) but the swipe up on the AppBarLayout stops working. Maybe because fitsSystemWindows interferes with the CoordinatorLayout behaviors. I know this is not a fix but maybe is a helpful tip for someone who might fix this.

tvalle avatar Jan 31 '21 01:01 tvalle

If it is ok, I would like to work on this issue

ryg-git avatar Apr 22 '21 12:04 ryg-git

Please is this issue still open to be tackled?

kolanse avatar Jul 18 '21 00:07 kolanse

The above commit is unfortunately not a solution. I'm not convinced this is the right approach for a few reasons listed below, but it could be on the right track.

  • I am not 100% sure this isn't possible without subclassing AppBarLayout.ScrollingViewBehavior. That behavior does adjust positioning, but I haven't found where it or its parent alters view size. I haven't exhausted the search, but if the behavior can do that, it'd be best to use its ability to do so. Layout Inspector showed me that for everything else I tried, the FrameLayout that contains the WebView is the same size as the CoordinatorLayout and is pushed down by the AppBar, clipping the bottom of the FrameLayout and therefore the WebView
  • sketch.io still scrolls while drawing and the AppBar still hides. This is likely because my solution uses padding instead of resizing the view which means the FrameLayout is still larger than the viewable area when the AppBar is visible. My attempts at actually resizing the view performed worse (jittery movement)
  • The web page layout of twitter.com looks incorrect when scrolling is first initiated, but returns to what's expected during the scroll. I noticed that other Android browsers behave the same way, but seem to correct it faster than this. This performance difference could be due to running a debug build.

I went ahead and committed my work and pushed it up to a fork in case it furthers discussion on an actual solution.

marcuswu avatar Jul 20 '21 21:07 marcuswu

I've iterated over my earlier code and have what I believe to be a working solution. I'd love some feedback.

marcuswu avatar Jul 30 '21 21:07 marcuswu

Why not taking into account the height of the navigation bar?

oldergod avatar Jan 22 '22 15:01 oldergod

@marcuswu could you just please open a Pull Request with your fix. This fix needs attention - nobody cares about it -.-

ChiefORZ avatar Apr 14 '22 13:04 ChiefORZ

I am not convinced my solution was ever really 100% correct. I did open a PR for it, but it was closed because it was supposed to be working properly on the latest code. I would look again, but I have some other projects taking my time right now.

marcuswu avatar Apr 14 '22 13:04 marcuswu

Hey, I'd like to contribute. can I work on this issue? Does this still need help?

mohammadreza-torkaman avatar May 20 '22 10:05 mohammadreza-torkaman

I I'd like to fix this.

AndroidPoet avatar Jun 02 '22 08:06 AndroidPoet

Just chiming in to provide another example where this behavior is easily reproducible:

http://szimek.github.io/signature_pad/

We are leveraging the SignaturePad library in one of our projects, but this issue has meant we have to recommend our DuckDuckGo users to switch to Chrome.

nb1987 avatar Jul 25 '22 10:07 nb1987

Seems it might be resolved with the latest version of dev:

Tried it with version 5.138.1 on below devices with Android 13

  • Google Pixel 4a
  • Google Pixel 5a

MohitMandalia avatar Oct 03 '22 15:10 MohitMandalia

Closing this stall issue. This doesn’t apply anymore.

malmstein avatar Jun 23 '23 09:06 malmstein

Not sure why this was closed, this is still very relevant and still appearing on versions > 5.138.1

StampixSMO avatar Sep 13 '23 14:09 StampixSMO